failed to retrieve token, but accesses KeyVault anyways
See original GitHub issueUsing the very first code example on the page and logging the credential
to the console
const { DefaultAzureCredential } = require("@azure/identity");
const { SecretClient } = require("@azure/keyvault-secrets");
const credential = new DefaultAzureCredential();
console.log(credential)
results in
DefaultAzureCredential {
UnavailableMessage: 'DefaultAzureCredential => failed to retrieve a token from the included credentials. To troubleshoot, visit https://aka.ms/azsdk/js/identity/defaultazurecredential/troubleshoot.',
...
.
However, the following requests using the KeyVault client with
const client = new SecretClient(url, credential);
are successful. How can the client access the KeyVault without retrieving the token? Shouldn’t the token error above break the flow? 🤔
Cheers
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
- ID: f034ccd7-da1a-6dc0-2eb2-bfac423ded5c
- Version Independent ID: 67d87a21-ca75-8909-03ac-bea6827cc133
- Content: Azure Key Vault Secret client library for JavaScript
- Content Source: docs-ref-services/latest/keyvault-secrets-readme.md
- Service: keyvault
- GitHub Login: @timovv
- Microsoft Alias: timov
Issue Analytics
- State:
- Created 10 months ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Unable to retrieve OAuth access token using Azure Key vault ...
I am trying to use Azure Key vault scope in my Oauth 2.0 request to retrieve the access token using Client credentials grant...
Read more >Failure to get token from Azure Key Vault - Stack Overflow
Multiple attempts failed to obtain a token from the managed identity endpoint. ... error: TS003: Error, TS004: Unable to get access token.
Read more >AZIdentity | Key Vault Client: Why am I seeing HTTP 401?
Client makes an REST call to the Key Vault to retrieve the secret, but without an access token. This results in HTTP 401....
Read more >Power Platform environment variable secrets from Azure Key ...
fetch the contained information from that environment variable: Azure subscription id, Resource Group name, Key Vault name and secret name; use ...
Read more >Accessing Azure Key Vault from within Azure API Management
Key Vault Access Policies Let's go to the Access Policies pane of ... get-cached-secret Typically, we don't want to return a secret but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@letzfets Since you are logging the credential object itself
console.log(credential)
you are seeing the property on the credential class that contains the message: https://github.com/Azure/azure-sdk-for-js/blob/857929dc41ed0dcf369092fb34f48f3b97525e9c/sdk/identity/identity/src/credentials/defaultAzureCredential.ts#L150If you’d like to enable logging to see which credential succeeded, please consult https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#logging
Yeah, makes sense now. Thank you so much. 🙏