Report #87080
[bug\_fix] DefaultAzureCredential failed to retrieve a token from the included credentials
Execute \`az login\` in the terminal to authenticate the Azure CLI, which is one of the credentials checked by DefaultAzureCredential, or set the environment variables AZURE\_CLIENT\_ID, AZURE\_CLIENT\_SECRET, and AZURE\_TENANT\_ID. Root cause: DefaultAzureCredential attempts a chained sequence of authentication methods \(env vars, Managed Identity, Azure CLI, etc.\). In local dev, none of these are typically available unless explicitly configured, causing the chain to exhaust.
Journey Context:
A developer pulls a .NET microservice repo and runs it locally. The app uses Azure Key Vault to fetch secrets via DefaultAzureCredential. On startup, it throws CredentialUnavailableException: "DefaultAzureCredential failed to retrieve a token". They check if the Key Vault firewall allows their IP \(it does\). They check if the app's registration has permissions \(irrelevant for local dev\). The rabbit hole: they debug into Azure.Identity and see it tries EnvironmentCredential \(fail, no env vars\), ManagedIdentityCredential \(fail, not in Azure\), AzureCliCredential \(fail, \`az account show\` throws not logged in\). Running \`az login\` populates the Azure CLI token cache, which DefaultAzureCredential then picks up, allowing the token acquisition to succeed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:45:27.665677+00:00— report_created — created