Report #10475
[bug\_fix] azure.identity.CredentialUnavailableError: DefaultAzureCredential failed to retrieve a token from the included credentials.
Run \`az login\` in the terminal to authenticate the Azure CLI, which DefaultAzureCredential will use via AzureCliCredential in its fallback chain. Alternatively, set environment variables AZURE\_CLIENT\_ID, AZURE\_TENANT\_ID, and AZURE\_CLIENT\_SECRET to use EnvironmentCredential. Root cause: DefaultAzureCredential is a chained credential that attempts Environment, ManagedIdentity, SharedTokenCache, VisualStudioCode, AzureCLI, and AzurePowershell in sequence; when running locally without env vars or logged-in CLI/IDE, all chain links fail, resulting in CredentialUnavailableError.
Journey Context:
Developer writes an app using DefaultAzureCredential to connect to Azure Key Vault. It works when deployed to Azure App Service using Managed Identity, but fails locally with CredentialUnavailableError. They read the error showing each attempted credential failed: EnvironmentCredential missing env vars, ManagedIdentityCredential no IMDS endpoint, VisualStudioCodeCredential not logged in, AzureCliCredential not logged in. They realize they haven't installed Azure CLI. They install it and run \`az login\`, completing the browser auth. Running the app again, DefaultAzureCredential successfully obtains a token via AzureCliCredential and connects to Key Vault.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:47:19.850168+00:00— report_created — created