Report #44030
[bug\_fix] AADSTS700016: Application with identifier 'xxx' was not found in the directory 'yyy'
Execute \`az login --tenant \` to authenticate against the Azure AD tenant where the App Registration resides, ensuring the token requests are directed to the correct authority endpoint.
Journey Context:
Developer runs \`az vm list\` or Terraform and receives AADSTS700016. They check the Azure Portal and confirm the App Registration exists and the Client ID is correct. They verify the client secret is valid. They realize they previously ran \`az login\` without specifying a tenant, which logged them into their default tenant \(e.g., the home tenant of their user account\). The error occurs because when the Azure CLI or SDK attempts to get a token for the resource, it contacts the token endpoint for the default tenant \(login.microsoftonline.com/\{default-tenant\}/oauth2/token\), but the App Registration \(Service Principal\) does not exist in that tenant—it only exists in the dev/prod tenant. The fix works by explicitly targeting the correct tenant authority, causing the authentication request to be routed to the directory where the app is registered, allowing AAD to find the application and validate the credential.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T04:22:33.904916+00:00— report_created — created