-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [MSAL] Azure-Identity: UsernamePasswordCredential.GetToken was unable to retrieve an access token (Value cannot be null. (Parameter 'tenantId')) #47584
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
Hi @johnypony3 - I tried to reproduce the error based on your configuration above and I don't see the problem. |
Hi @johnypony3. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
@christothes I will provide the info, currently afk. I will update my post with the ASE being disconnected. Could you try that way please? The only logs I have are provided. Please advise if there is anything I can do to facilitate more verbose logging. I also updated the code to the tenant id being Apologies for missing these pieces of info, thank you for your time. |
@christothes I believe this issue is what I am having still: AzureAD/microsoft-authentication-library-for-dotnet#4860 |
It appears different to me, but the full stack trace and the full logging output should provide more context. |
Hi @johnypony3. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
Got it, I am new to this space and I am looking for clues :) I added loggers with LogAlways with the results below. I'd like to point out that with fiddler enabled, I do not see any calls being made when using version 1.13.1 of the Azure.Identity package. This error is happening locally. Console logs:
Stack trace:
|
Thanks @johnypony3 - in the stack trace above, is there possibly an inner exception that is missing? There is nowhere in Azure.Identity directly that throws that ArgumentNullException for tenantId during the GetToken code path, but it's possible that it is coming from one of its dependencies. If not, can you run your repro under the debugger and enable all exceptions to see from where this is being thrown? |
Hi @johnypony3. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
{
"Timestamp": "12/18/2024 6:22:35 PM",
"ExceptionDetails": {
"Type": "Azure.Identity.AuthenticationFailedException",
"Message": "UsernamePasswordCredential authentication failed: Value cannot be null. (Parameter 'tenantId')\nSee the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/usernamepasswordcredential/troubleshoot",
"StackTrace": " at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage, Boolean isCredentialUnavailable)\r\n
at Azure.Identity.UsernamePasswordCredential.AuthenticateImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)\r\n
at Azure.Identity.UsernamePasswordCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)\r\n
at Azure.Identity.CredentialDiagnosticScope.FailWrapAndThrow(Exception ex, String additionalMessage, Boolean isCredentialUnavailable)\r\n
at Azure.Identity.UsernamePasswordCredential.GetTokenImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)\r\n
at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](Task`1 task)\r\n
at Azure.Identity.UsernamePasswordCredential.GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken)\r\n
at Program.Main(String[] args) in C:\\Users\\v-redacted\\source\\TCP-ArmClient\\TCP-ArmClient\\Program.cs:line 64",
"Source": "Azure.Identity",
"HResult": -2146233088,
"Data": {},
"InnerException": {
"Type": "System.ArgumentNullException",
"Message": "Value cannot be null. (Parameter 'tenantId')",
"StackTrace": " at Microsoft.Identity.Client.AbstractAcquireTokenParameterBuilder`1.WithTenantId(String tenantId)\r\n
at Microsoft.Identity.Client.AbstractAcquireTokenParameterBuilder`1.WithTenantIdFromAuthority(Uri authorityUri)\r\n
at Azure.Identity.MsalPublicClient.AcquireTokenByUsernamePasswordCoreAsync(String[] scopes, String claims, String username, String password, String tenantId, Boolean enableCae, Boolean async, CancellationToken cancellationToken)\r\n
at Azure.Identity.MsalPublicClient.AcquireTokenByUsernamePasswordAsync(String[] scopes, String claims, String username, String password, String tenantId, Boolean enableCae, Boolean async, CancellationToken cancellationToken)\r\n
at Azure.Identity.UsernamePasswordCredential.AuthenticateImplAsync(Boolean async, TokenRequestContext requestContext, CancellationToken cancellationToken)",
"Source": "Microsoft.Identity.Client",
"HResult": -2147467261,
"Data": {},
"InnerException": null
}
}
} InnerException is null. |
It would be helpful to know the specific value you are using for |
Hi @johnypony3. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
I updated the code in this issue yesterday am and called it out :) |
Did you mean to type "adfs" by chance? 😄 If so, yes, I can reproduce this now and I agree it seems to be an issue with the MSAL library. Please provide your repro details to the issue over there so that they can investigate further - AzureAD/microsoft-authentication-library-for-dotnet#4860 |
Ha! Yes, I meant adfs :D Ok, I will post my code there. Is your opinion to close this issue? |
we'll keep it open until things resolve in the other issue. |
Library name and version
Azure.Identity 1.13.1
Describe the bug
Starting at 1.11.0 the code below does not work. If I downgrade to one version lower, 1.10.4 this code works without issue.
Expected behavior
No erros
Actual behavior
Errors with this:
Reproduction Steps
Change to version 1.11.0 or later to fail
Change to version 1.10.4 or earlier to work
Environment
Windows, VS2022, .net 6 or 8
ASE is disconnected
The text was updated successfully, but these errors were encountered: