Report #44914
[bug\_fix] azure.identity.CredentialUnavailableError: DefaultAzureCredential failed to retrieve a token from the included credentials
Ensure you are authenticated via the Azure CLI by running \`az login\` and selecting the correct subscription with \`az account set --subscription \`. Alternatively, set the environment variables \`AZURE\_CLIENT\_ID\`, \`AZURE\_TENANT\_ID\`, and \`AZURE\_CLIENT\_SECRET\` to use a Service Principal, or use \`AzureCliCredential\` explicitly instead of \`DefaultAzureCredential\` to force CLI-based auth.
Journey Context:
A developer runs a Python application locally that uses \`DefaultAzureCredential\` to connect to Azure Key Vault. It works on their Azure Virtual Machine but fails locally with CredentialUnavailableError. They check \`az account show\` and see they are logged in, so they assume it should work. They check the \`DefaultAzureCredential\` documentation and see it tries EnvironmentCredential first, then ManagedIdentityCredential, then SharedTokenCacheCredential \(Windows only\), then AzureCliCredential. They realize that on their Linux laptop, there is no shared token cache, and they haven't set the env vars. The CLI credential is tried last. They run \`az login\` again to ensure the token is fresh, and it works. They later switch to explicitly using \`AzureCliCredential\(\)\` to avoid ambiguity in the credential chain.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:51:20.067373+00:00— report_created — created