-
Notifications
You must be signed in to change notification settings - Fork 2.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
DefaultAzureCredentials fails with "Access denied" when connecting to key vault #16766
Comments
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @southpolesteve, @zfoster |
"Access denied to first party service" typically occurs with MSA accounts, i.e. user accounts from @hotmail.com, @live.com, @outlook.com. Are you signed in to VS Code with one of those accounts? |
Hi, we're sending this friendly reminder because we haven't heard back from you in a while. We need more information about this issue to help address it. Please be sure to give us your input within the next 7 days. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
I am using vscode with outlook account and get the same error : HttpResponseError: (Forbidden) Access denied to first party service. svc_pr_password = client.get_secret(secretName) |
You'll see this error when trying to authenticate an MSA account through the credential's default tenant, which can only authenticate work or school accounts. Specify the tenant to work around it: DefaultAzureCredential(vscode_tenant_id="some UUID")
# or if you want to authenticate only through VS Code
VisualStudioCodeCredential(tenant_id="some UUID") #14808 tracks making this more convenient by using the tenant configured in VS Code's user settings, if any. |
@chlowell Thanks it helped |
what is vscode_tenant_id ? where to find ? |
You only need to specify a tenant ID when you want to authenticate in a different tenant. The value is typically a UUID like b0ae42e0-496e-4216-8811-e64c72a29c59 (which is just a random UUID, not a real tenant's ID). The correct value depends on the resource(s) you want to access. For example, if you want to access a Key Vault in tenant "A", you should set |
Describe the bug
Visual studio code credentials not working when trying to connect to key vault (and possibly other types of resources?). If I disable the VSCode credentials, it probably uses Azure CLI credentials instead, which works fine. Note that
DefaultAzureCredential
used to work, but stopped for some reason (might have stopped working after I installed MS Teams?). I'm very certain that I have logged into the same account in VSCode, Azure CLI and in Windows.To Reproduce
Setup a key vault and give yourself access. Add a secret to the key vault and run the following code
Log output
Error (IDs removed)
Expected behavior
The script should be able to pull the secret and print the value.
Additional context
Not sure if this is really belongs here, but I don't really know where else to direct this.
The text was updated successfully, but these errors were encountered: