Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

AADSTS700016: "The application wasn't found in the directory/tenant" (UnauthorizedClient_DoesNotMatchRequest)

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

AADSTS700016 is the Microsoft Entra ID error that says the sign-in request named an application and the tenant it went to has no such application. Microsoft's error reference gives the name UnauthorizedClient_DoesNotMatchRequest and the text: "The application wasn't found in the directory/tenant. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have misconfigured the identifier value for the application or sent your authentication request to the wrong tenant."

So three values decide it: the application's identifier in your configuration, the tenant the request goes to, and whether the application is present in that tenant. Compare all three before changing anything.

What the error means

A Microsoft Entra app registration has an Application (client) ID. Microsoft's registration page tells you to record it and says it "uniquely identifies your application and is used in your application's code as part of validating the security tokens it receives from the Microsoft identity platform." The page also says: "Once created, you can't move the application object between different tenants."

When a sign-in request arrives at a tenant, Microsoft Entra ID looks for that identifier there. AADSTS700016 is the answer when it finds nothing. Microsoft's error text names three reasons and does not rank them.

Whether a tenant has the application depends on how it was registered. Microsoft's multitenant page says: "By default, web app/API registrations in Microsoft Entra ID are single-tenant upon creation." For a multitenant application, a user from a different tenant is asked to consent the first time. Microsoft's page says a service principal, the representation of the application inside that tenant, is created when the user or an administrator consents. Microsoft's error page does not name single-tenant or multitenant registration as a cause, so treat that as a question to answer by checking, not an assumption.

Likely causes

Cause What you see How to confirm
The identifier in the application's configuration is not the Application (client) ID of the registration Microsoft names no pattern; the same error in the tenant that holds the registration would point here Compare the configured value with the Overview page of the app registration
The request goes to a tenant other than the one that holds the registration Microsoft names no pattern; the authority URL names a tenant other than the registration's Compare the tenant in the authority URL with the tenant of the app registration
A multitenant application has not been consented to in the signing-in user's tenant Microsoft names no pattern; the application is absent from that user's tenant Look for the application in that tenant's Enterprise applications list
The registration is single-tenant but used from other tenants Same pattern as the row above Read the Supported account types setting on the registration
Users cannot consent and no administrator has The application is absent in the tenant Check Consent and permissions in Enterprise applications for "Do not allow user consent"

Prove the cause before changing anything

All of these read only.

  1. Sign in to the Microsoft Entra admin center as at least an Application Developer. If you have access to several tenants, use the Settings icon in the portal's menu bar to switch to the tenant that holds the registration.
  2. Browse to Entra ID > App registrations and select the application. On the Overview page read the Application (client) ID and the Application ID URI.
  3. Compare the Application (client) ID character by character with the value in the application's configuration.
  4. Select the Authentication pane and read the Supported account types section.
  5. In the application's code or configuration, read the authority. Microsoft's multitenant page names https://login.microsoftonline.com/common for work, school and personal accounts and https://login.microsoftonline.com/organizations for work or school accounts. Microsoft's page says a multitenant application cannot send requests to one tenant's endpoint, because it cannot immediately tell which tenant the user is from.
  6. In the tenant that shows the error, browse to Entra ID > Enterprise apps, remove the filters and search for the application. Microsoft's page on signing in to Windows virtual machines in Azure with Microsoft Entra ID uses this route to check whether the service principal of one specific application exists in a tenant. It is not a Microsoft instruction for AADSTS700016.

Example (illustrative): at contoso.com.au the reporting application app01 is registered in the contoso.com.au tenant. Its configuration holds the Application (client) ID of the registration, but its authority names the tenant of a separate test directory. Users at the test directory see AADSTS700016. The Overview page and the configured ID match, the authority tenant is not the tenant that holds the registration, and the application is absent from the test tenant's Enterprise apps list, so the wrong tenant is the cause.

Fix

Cause: wrong identifier or wrong authority in the configuration

Before you change it, keep a copy of the application's configuration file or settings page as it stands, showing the current identifier and authority.

Risk: the next change sets the identifier and tenant that every sign-in from this application uses. A wrong value stops sign-in for all of its users, and the application may need a restart to read new settings; Microsoft's pages say nothing about that, so test in a non-production copy first.

Set the identifier to the Application (client) ID from the Overview page and the authority to the tenant that holds the registration, or to /organizations or /common if the application is multitenant.

To undo it, put the saved copy of the configuration back and start the application again.

Cause: single-tenant registration used from other tenants

Before you change it, write down the current Supported account types selection and the Application ID URI from the Overview page.

Risk: the next steps allow users in any Microsoft Entra tenant to sign in after they consent. Microsoft's pages say the change can fail on Application ID URI name collisions, and fails if the Application ID URI does not follow the form of a URI under a domain verified for the tenant, such as https://contoso.onmicrosoft.com/myapp. It also says the application code must send requests to /common and handle several issuer values, so the registration change on its own does not make an existing application work for other tenants.

  1. In the Microsoft Entra admin center select the app registration, then select the Authentication pane.
  2. In the Supported account types section, change the setting to Accounts in any organizational directory, the name Microsoft's convert page uses. Microsoft's registration page lists the same choice as "Multiple Entra ID tenants", so the label in your portal may differ.

To undo it, return the setting to the selection you wrote down. Microsoft's pages do not say what happens to consents already given in other tenants.

Cause: not consented to in the tenant

Microsoft's multitenant page says a service principal is created in the user's tenant when someone consents, and that app-only permissions always need an administrator's consent. It also says a tenant administrator can disable user consent, in which case administrator consent is always required. For an application that needs it, the page describes an authorization request that includes the prompt=consent parameter, started by the tenant administrator.

Before you consent, write down the permissions the application asks for. Microsoft's page says consent for all users in a tenant by an administrator cannot be revoked by individual users.

Risk: an administrator's consent grants the application's requested permissions, and for permissions granted for all users only an administrator can take them back. Consent only for an application the customer's organisation intends to use.

Have the administrator of that tenant complete the consent request.

To undo it, an administrator revokes access. Microsoft's page says: "Administrators revoke access to applications by removing them using the Enterprise applications section of the Microsoft Entra admin center. Select the application and navigate to the Permissions tab to revoke access."

Confirm the fix

  • Sign in again from the same tenant that showed AADSTS700016. The error should not return.
  • In that tenant, the application should appear in Entra ID > Enterprise apps.
  • A token returned from the sign-in carries an issuer value that tells the application which tenant the user is from, as Microsoft's page describes.

What to watch afterwards

  • The first sign-in from each new tenant, since each tenant needs its own consent.
  • Any change of the application's authority or identifier in a later release.
  • Tenants that disable user consent.

Risks and limits

These steps have not been run or lab-tested.

Microsoft's error reference gives a short description for AADSTS700016. It lists not installed or consented to, a wrong identifier, and the wrong tenant, in that order, and does not rank them. Microsoft's reference prints this short text only. Portal paths and labels may change. Consent decisions belong to the tenant's own administrators.

Sources