Report #44554
[bug\_fix] AADSTS700016: Application with identifier was not found in the directory
Configure the Azure Identity credential to use the correct cloud authority \(e.g., AzureUSGovernment or AzureChina\) via the AZURE\_AUTHORITY\_HOST environment variable, or ensure the app registration exists in the target tenant.
Journey Context:
A developer writes a tool using DefaultAzureCredential to manage Azure resources. It works against commercial Azure \(AzurePublic\). The team decides to deploy to Azure Government \(MAG\). The developer sets AZURE\_SUBSCRIPTION\_ID to the gov subscription but forgets to change the authority. They receive AADSTS700016. The app registration exists in the commercial tenant, but the token endpoint being hit is login.microsoftonline.us \(gov\), which does not know about the commercial app registration. Alternatively, the developer might have the right cloud but the wrong tenant ID where the app is not registered. Setting AZURE\_AUTHORITY\_HOST to https://login.microsoftonline.us and ensuring the app is registered in the gov tenant resolves the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:15:11.989147+00:00— report_created — created