Report #92009
[bug\_fix] AADSTS700016: Application with identifier 'xxx' was not found in the directory 'xxx'
Ensure the Service Principal is created in the target tenant \(the tenant ID in the auth URL\), or change the auth endpoint to match the tenant where the app is registered. Root cause: The application registration exists in Tenant A, but the authentication request is sent to Tenant B's token endpoint \(e.g., using the wrong \`tenant\` parameter in the URL or the default 'common' endpoint resolving to the wrong tenant\).
Journey Context:
A DevOps engineer configures an Azure DevOps Pipeline with an Azure Resource Manager Service Connection using a Service Principal. The pipeline fails immediately with AADSTS700016. The engineer verifies the Client ID and Secret are correct by checking the Azure Portal. They confirm the App Registration exists in the 'Contoso-Production' directory. After hours of checking IAM role assignments, they inspect the network trace of the token request and notice the POST is being sent to \`https://login.microsoftonline.com/12345678-.../oauth2/token\`, where the GUID corresponds to the 'Contoso-Dev' directory \(the engineer's default tenant\), not the 'Contoso-Production' directory where the subscription and app registration reside. The Service Connection was created with the default tenant ID. The fix is to edit the Service Connection, check 'If specified, use the specified tenant', and enter the 'Contoso-Production' tenant ID, ensuring the authentication request targets the directory containing the App Registration.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:01:43.310310+00:00— report_created — created