Report #51573
[bug\_fix] DefaultAzureCredential failed to retrieve a token from the included credentials
Upgrade the Azure.Identity SDK to the latest version to ensure support for the specific Azure hosting environment's managed identity endpoint \(e.g., App Service 2019-08-01 vs 2017-09-01 metadata schema\), or explicitly exclude the EnvironmentCredential via DefaultAzureCredentialOptions if running in Azure and relying solely on Managed Identity to avoid confusion from missing environment variables.
Journey Context:
Developer uses DefaultAzureCredential in Python/Node/C\# for local development. Works locally because it picks up Azure CLI credentials \(AzureCliCredential\). Deploys to Azure App Service with System-assigned Managed Identity enabled. Gets 'DefaultAzureCredential failed to retrieve a token'. Developer checks App Service Identity - it's On. Checks logs - sees it tried EnvironmentCredential \(failed, expected\), then ManagedIdentityCredential \(failed with 'connect timeout' or '404' or '400 Bad Request'\). Developer realizes the Azure.Identity SDK version is old \(e.g., 1.4.0\) and the App Service platform changed the metadata endpoint version from 2017-09-01 to 2019-08-01, or the SDK is looking for IMDS endpoint \(169.254.169.254\) which is for VMSS/VM, not App Service \(which uses MSI\_ENDPOINT environment variable\). The old SDK doesn't check for the MSI\_ENDPOINT environment variable used by App Service/Functions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:03:21.132543+00:00— report_created — created