-
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] Azure.Identity DefaultAzureCredential in Visual Studio fails when MFA required #11595
Comments
I should also note that using |
Hi @Jawvig , |
Ah, I had missed the "Code" part of the So, I'm sorted out. However, should it have fallen back on some other mechanism when that one failed? Visual Studio or Azure CLI? |
Visual Studio and Azure CLI are checked first, so they have failed for some reason. However, |
Is the |
Both. Can I ask you to sign out from Visual Studio Code Azure Account and try to reproduce this bug again? |
Sure. I ran the "Azure: Sign Out" command in VS Code and re-ran the sample in debug from Visual Studio. I got the following exception. I closed both and reopened Visual Studio to run it again but with the same result.
|
Ok, let's try to disable var credential = new DefaultAzureCredential(new DefaultAzureCredentialOptions() {ExcludeVisualStudioCodeCredential = true});
var blobContainerClient = new BlobContainerClient(blobContainerUri, credential); |
I've done that and this time it works without error. |
Ok, then we have two bugs related to |
…ual Studio fails when MFA required - Fix Azure#11371: [BUG] AzureConfigurationBuilder fails to build connection strings when deployed to App Service - Remove some dead code
Tried
If |
Describe the bug
From within Visual Studio, running code that uses
DefaultAzureCredential
with an account that requires MFA results in an exception. The credential was used with aBlobContainerClient
from the v12 Azure Storage client library. The problem can be reproduced in a Console app running in Debug in Visual Studio but also occurs when using MS Test or ReSharper test runners.Visual Studio contains the required account in the list of accounts (Account Settings -> All Accounts) and the account was removed and re-added (and thus re-authenticated).
Expected behavior
The
DefaultAzureCredential
should either just work or move into an OAuth workflow to obtain a token.Actual behavior (include Exception or Stack Trace)
Exception thrown at the point the first data is attempted to be retrieved:
To Reproduce
Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)
Environment:
The text was updated successfully, but these errors were encountered: