Report #87565
[bug\_fix] DefaultAzureCredential failed to retrieve a token from the included credentials or AuthenticationRequiredError in local development
Execute \`az login\` in the Azure CLI to establish an authenticated session for the AzureCliCredential component, or set the environment variables AZURE\_CLIENT\_ID, AZURE\_CLIENT\_SECRET, and AZURE\_TENANT\_ID to authenticate as a Service Principal via EnvironmentCredential.
Journey Context:
Developer writes a .NET application using \`DefaultAzureCredential\` to connect to Azure Key Vault. Running locally in Visual Studio, it works because Visual Studio Credential picks up the VS authentication. However, when running the same code in a terminal or VS Code on macOS, it throws \`AuthenticationFailedException: DefaultAzureCredential failed\`. The error details show that EnvironmentCredential was unavailable \(missing env vars\), ManagedIdentityCredential was unavailable \(not in Azure\), VisualStudioCredential was unavailable \(no VS token found\), AzureCliCredential failed \(no account found\), and PowerShellCredential was unavailable. The developer realizes they have never run \`az login\` on this machine, or their session has expired. They run \`az login\`, complete the browser authentication, and rerun the application. The DefaultAzureCredential successfully invokes AzureCliCredential, which retrieves a token from the Azure CLI's cache, and the Key Vault access succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:33:57.962967+00:00— report_created — created