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] DefaultAzureCredential VisualStudioCredential unable to retrieve an access token. #29540
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
I am also having the issue exactly as described. |
@jsquire Is there any update on this? Thank you! |
@LeePhillipsFreemarket Have you found any workaround/solution for this? |
@AndrewCS149 Not exactly. When developing locally i'm just using a direct connection string now. When the service is used in azure using managed identity. Another way round would be to log into azure using powershell as a fallback and just setting ExcludeVisualStudioCredential to true so it doesn't use it. I've not found a workaround that actually makes use of the VisualStudioCredential. |
Hi @AndrewCS149 - Could you provide some sample code that shows how you are calling the azure resource? Are you using another client SDK or fetching the token manually? Also, could you provide the log output of your repro? Details can be found here: |
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
Same here, I'm creating instances of blob client like this: new BlobServiceClient(new Uri(blobServiceUri), new DefaultAzureCredential(options)) When I perform any operation on this client afterwards the error I get is the following:
I'm using .net 6, function app v4 running on Windows 11. Core tools version is 4.0.4829. function runtime version is 4.11.2.19273. What I'm trying to do is to use managed identity for blob storage access and fallback to VisualStudioCredential while debugging my function app locally. The best workaround I found so far is to set var options = new DefaultAzureCredentialOptions
{
ExcludeAzureCliCredential = true,
ExcludeAzurePowerShellCredential = true,
ExcludeEnvironmentCredential = true,
ExcludeInteractiveBrowserCredential = true,
ExcludeManagedIdentityCredential = false,
ExcludeSharedTokenCacheCredential = true,
ExcludeVisualStudioCodeCredential = true,
ExcludeVisualStudioCredential = false,
VisualStudioTenantId = "<your Azure AD Tenant ID here>"
};
return new BlobServiceClient(new Uri(blobServiceUri), new DefaultAzureCredential(options)); I found this solution here: #13228. The theory is that this bug occurs when accounts have multiple tenants but my account has only one tenant. |
Hi, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
Library name and version
Azure.Identity.DefaultAzureCredential
Describe the bug
I am attempting to authenticate to Azure using the
DefaultAzureCredential
in my program. However, after I create theDefaultAzureCredential
attempt to use it, I receive an error stating that the VisualStudioCredential.GetToken was unable to retrieve an access token.When I attempt to actually use the token, I receive this exception:
Expected behavior
Successfully authenticate and interact with Azure resources.
Actual behavior
Receive an exception stating 'VisualStudioCredential.GetToken was unable to retrieve an access token'.
Reproduction Steps
DefaultAzureCredential
Environment
Windows 11
.NET 6
Visual Studio 2022
The text was updated successfully, but these errors were encountered: