-
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
Azure.Identity: VisualStudioCodeCredential causes difficult to debug issues when using a live account #19511
Comments
Thank you for your feedback. Tagging and routing to the team member best able to assist. |
Hi @allanlw - Does this reproduce if you set |
@christothes That does not fix the problem. |
Thanks @allanlw - Then it sounds like the VisualStudioCredential is attempting to login with a different identity. |
Well, it's the same credentials. The problem is that the tenant is wrong.
However, the VS code help for the You can see this in action in:
and For all the azure plugins in VS code, they work fine with it unset. It would seem the implementation in vscode does a two-stage login if the tenant is the and: I might be missing something, but I don't see the same logic occurring in Maybe this bug is a documentation and/or error message one, but regardless it was difficult to debug and a bad user experience. |
Note: this comment exactly matches my experience, except for VS Code. #17235 (comment)
|
Hi @allanlw Thanks for providing such great context for this issue. I spent some time looking into this problem. The bad news is that, in the short term, there isn't a great alternative to providing the TenantId hint to the credential options (or to VSCode's options). However, there is some longer range feature work we are considering that would address this problem more generally when trying to authenticate to services that support providing the tenant Id back as part of the For example, services like Key Vault and Storage return back an I created issue #20203 to track some work to improve the error experience for scenarios like this. |
Summary: When using the
DefaultAzureCredential
(and thereforeVisualStudioCodeCredential
), and being logged into VSCode with an Azure account where the login is via Microsoft Live leads to tenant errors unless the tenant is explicitly set in the VSCode options.Attempting to run the following code:
Gives me the following error:
You'll note that
f8cdef31-a31e-4b4a-93e4-5f571e91255a
is the default dummy tenant for Microsoft live accounts, which is sort of documented here.Setting the
azure.tenant
seting in the VSCode Azure login package solves the problem. Logging out of VSCode Azure login also worked for me because it would then pick up my Azure CLI credentials, which automatically have the right tenant ID.I believe this is a bug in
Azure.Identity
because I have no other issues using the VSCode azure login plugin without explicitly setting the tenant ID.Environment:
VSCode version: 1.54.2
VSCode Azure Account plugin version: 0.97
Azure.Identity version: 1.3.0
zure.ResourceManager.Resources version: 1.0.0-preview.2
See also #17235 and even #11559 which are perhaps related because it is using the live dummy tenant id but that's not mentioned in the thread.
The text was updated successfully, but these errors were encountered: