[BUG] VisualStudioCredential fails with AADSTS65002
See original GitHub issueLibrary name and version
Azure.Identity 1.4.0 or later
Describe the bug
Looks like #8945 came back again for Azure.Identity
1.4.0 or later. The DefaultAzureCredential
stopped falling back to other credentials after it failed with the ManagedIdentityCredential
.
Here is the exception message
Unhandled exception. Azure.Identity.CredentialUnavailableException: DefaultAzureCredential failed to retrieve a token from the included credentials. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/defaultazurecredential/troubleshoot
- EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
- ManagedIdentityCredential authentication unavailable. The requested identity has not been assigned to this resource.
Status: 400 (Bad Request)
Content:
{"error":"invalid_request","error_description":"Identity not found"}
Note that this happens on a VM from the DevTest lab. The fact that it’s an Azure VM may have confused the library. When I downgraded Azure.Identity
to 1.3.0 or earlier, everything worked like a charm.
Expected behavior
DefaultAzureCredential falls back to other credentials after failing with ManagedIdentityCredential
Actual behavior
DefaultAzureCredential doesn’t fall back to other credentials after failing with ManagedIdentityCredential
Reproduction Steps
Use DefaultAzureCredential on an Azure VM from the DevTest lab.
Environment
Windows 11, VS 17.4.0 Preview, .NET 6 app
Issue Analytics
- State:
- Created a year ago
- Comments:10 (3 by maintainers)
Top GitHub Comments
Updated Visual Studio to Version 17.5.0 Preview 1.0 [33024.329.main]. The
DefaultAzureCredential
worked again with Azure.Identity v1.7.0.I was using Visual Studio, so I would expect VisualStudioCredential or SharedTokenCacheCredential. I don’t know what is actually used when it was working with the older version of the package.