Report #11371
[bug\_fix] AADSTS700016: Application with identifier '...' was not found in the directory '...'
Ensure the Application \(client\) ID is registered in the target Entra ID tenant \(check App Registrations\), verify the authority/tenant\_id in code matches this tenant, and if the app is multi-tenant, ensure admin consent has been granted in the target tenant to provision the Enterprise Application \(service principal\). The root cause is either the app registration lives in a different tenant than the one specified in the authentication request, or the service principal does not exist in the target tenant because consent was never performed.
Journey Context:
You are developing a daemon service that uses ClientSecretCredential from the Azure.Identity Python SDK. You create an App Registration in your company's production Entra ID tenant, noting the client\_id and client\_secret. You write a test script that hardcodes these credentials and sets tenant\_id to the staging tenant ID \(a different Entra ID directory\). When you run the script, it throws AuthenticationFailedException with AADSTS700016. You verify the client\_id is correct by copying it from the Azure Portal App Registration overview blade. You check the 'Endpoints' tab and realize the App Registration only exists in the production tenant's directory. You consider creating a new App Registration in the staging tenant with a different client\_id, which would resolve the issue for testing. Alternatively, you change the tenant\_id in the code back to the production tenant, but then realize the network policies block prod access from dev machines. You then learn about multi-tenant apps: by changing the App Registration manifest in prod to 'signInAudience': 'AzureADMultipleOrgs', you can use the same client\_id in the staging tenant, but you must visit the admin consent URL \(https://login.microsoftonline.com/staging-tenant-id/adminconsent?client\_id=...\) to provision the Enterprise Application \(service principal\) in the staging tenant. After an admin consents, the AADSTS700016 error disappears because the directory now contains the app registration reference \(service principal\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:12:38.560805+00:00— report_created — created