Report #41495
[bug\_fix] Azure AADSTS700016: Application with identifier 'CLIENT\_ID' was not found in the directory 'TENANT\_ID'
Update the authority URL or authentication configuration to use the Tenant ID \(or domain\) where the App Registration actually resides, rather than 'common' or an incorrect tenant; for multi-tenant apps, ensure the app registration allows multi-tenant access and the user is consenting in their own tenant.
Journey Context:
A developer clones an internal company repository for a Node.js microservice that uses @azure/identity's DefaultAzureCredential. The service works perfectly in the staging environment \(Azure App Service\). The developer tries to run the service locally on their laptop to debug a new feature. They have logged in via Azure CLI \(\`az login\`\) using their corporate credentials. When the app starts, it throws an AuthenticationRequiredError with the inner AADSTS700016 message, stating the application wasn't found in the directory. The developer checks the Azure Portal and confirms the App Registration exists with the client ID shown in the error. After hours of confusion, they realize the environment variable AZURE\_TENANT\_ID in their local .env file is set to their personal Azure sandbox tenant ID \(from a previous side project\), while the App Registration is registered in the corporate tenant. The DefaultAzureCredential was picking up the tenant ID from the environment variable, constructing an authority URL for the wrong tenant. Removing the env var allows the credential to use the tenant ID from the logged-in Azure CLI context, or explicitly setting it to the corporate tenant fixes the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T00:07:16.828532+00:00— report_created — created