Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | AADSTS90002: Tenant not found. Check to make sure you have the correct tenant ID and are signing in to the correct national cloud. | Entra admin center > Monitoring > Sign-in logs | -> Error code 90002 |
| Affected build range | Microsoft 365 / Entra ID | Product documentation | - |
| Registry key or OMA-URI involved | - | - | - |
| Relevant service/endpoint URL | login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize | Browser address bar | -> Failed sign-in attempt |
| Log line signature | AADSTS90002: Tenant not found. | Entra admin center > Monitoring > Sign-in logs | - |
Log Files to Check
C:\Program Files\Microsoft Monitoring Agent\Agent\Logs\HealthService.logC:\inetpub\logs\LogFiles\W3SVC1\u_exYYYYMMDD.log
What This Error Actually Means
AADSTS90002 is an error code raised by Microsoft Entra ID during OAuth 2.0 token requests when the tenant identifier provided in the authority URL does not correspond to a valid Microsoft Entra tenant. The component responsible for this validation is the Azure AD authentication service, which checks the validity of the tenant identifier against its internal database before proceeding with the sign-in process or other operations that require tenant verification. This error can occur during various scenarios such as user sign-ins, API calls requiring tenant context, and application registrations that are tied to specific tenants. The exact error string is "AADSTS90002: Tenant not found. Check to make sure you have the correct tenant ID and are signing in to the correct national cloud."Affected Versions and Scope
This issue affects Microsoft 365 / Entra ID environments where OAuth 2.0 token requests are made with an incorrect or invalid tenant identifier. It is important to note that this error does not occur across all versions of Microsoft products; it specifically targets configurations involving Entra ID for authentication purposes. The scope includes any application or service attempting to authenticate users or access resources through the OAuth 2.0 protocol, where the authority URL contains an incorrect tenant identifier. This can be a single-tenant app registered in a specific tenant or multi-tenant apps that should accept sign-ins from multiple tenants but are incorrectly configured.Where To Look First: Logs and Event IDs
To diagnose AADSTS90002, start by examining the following logs:C:\Program Files\Microsoft Monitoring Agent\Agent\Logs\HealthService.logC:\inetpub\logs\LogFiles\W3SVC1\u_exYYYYMMDD.log
- Event ID:
349 - Event ID:
1786
Root Causes
The root causes for AADSTS90002 can be categorized as follows:Misconfigured Tenant Identifier in Authority URL
This occurs when the {tenant} segment of the authority URL is incorrectly specified. This could be due to a typo, using an outdated tenant ID from a deleted development environment, or mistakenly referencing a different cloud endpoint.Incorrect National Cloud Endpoint Usage
Applications targeting specific national clouds (such as GCC High for US government customers) must use the correct login endpoint URL. Using a commercial tenant ID against a national cloud endpoint will result in this error.Incorrect Application Registration Configuration
Single-tenant applications registered to accept sign-ins only from their own directory may encounter AADSTS90002 if accessed by users or services outside of that specific tenant.Fix Procedure
To resolve the issue, follow these steps:Determine the correct tenant identifier. Use the Azure portal to navigate to
Azure Active Directory > Overview, and locate the Tenant ID field.If you need to verify programmatically, use PowerShell:
This command retrieves the tenant's unique identifier.Connect-AzureAD (Get-AzureADTenantDetail).ObjectIdUpdate your application configuration with the correct tenant ID. This can be done in code or via app settings depending on how your application is configured:
- For MSAL .NET, update the
AzureAdOptionsclass to include the correct TenantId. - For MSAL Python/JS applications, modify the authority parameter used when constructing the PublicClientApplication.
- For MSAL .NET, update the
If your application is multi-tenant but restricted by issuerValidator settings in a single tenant mode, change this configuration:
- In Entra admin center > App registrations > Authentication, update
Supported account typesto allow for 'Accounts in any organizational directory (Multi-Tenant)'.
- In Entra admin center > App registrations > Authentication, update
If the application's audience was recently changed due to a tenant recreation, modify the app registration's manifest:
This PowerShell snippet updates the signInAudience property to reflect the new tenant ID.Connect-MgGraph -Scopes "Application.ReadWrite.All" $application = Get-MgApplication -Filter "appId eq '{AppId}'" $application.signInAudience = 'AzureADMyOrg' Set-MgApplication -Application $applicationVerify that your application is correctly configured for national cloud endpoints if applicable:
- Login.microsoftonline.com for commercial tenants.
- Login.microsoftonline.us for GCC High and DoD tenants.
- Login.chinacloudapi.cn for China-based tenants.
Error Code Variants
| Error Code | Description |
|---|---|
| AADSTS90014 | Tenant is not registered for Microsoft Graph API. |
| AADSTS70001 | The tenant identifier provided does not match the expected format or structure. |
| AADSTS50029 | Password grant type is disabled in this directory. Ensure that password-based authentication is enabled for your tenant if required by your application. |
Verification
After applying the fixes, verify the resolution of AADSTS90002 by:- Opening the application sign-in URL and ensuring it resolves correctly without errors.
- Checking the
.well-known/openid-configurationendpoint for your tenant to confirm a valid HTTP 200 response with issuer details. - Reviewing Entra admin center > Monitoring > Sign-in logs for any new instances of AADSTS90002. The log line should no longer appear once the issue is resolved.
Prevention
To prevent recurrence, ensure that:- Your application's configuration management processes include validation steps to confirm tenant IDs are correct before deployment.
- You regularly review and update your application registration settings in Entra admin center to reflect any changes in multi-tenant or national cloud requirements.