Home › Entra ID › AADSTS50020

Entra ID · AADSTS50020 · Microsoft 365 / Entra ID

Entra ID Error AADSTS50020: External User Sign-In Failure

The error occurs when an external user attempts to sign in without being provisioned as a guest. Fix by inviting the user or adjusting tenant settings.

Error Details

FactValueSourceNote
Exact error stringAADSTS50020: User account from identity provider does not exist in tenantEntra admin center > Monitoring & health > Sign-in logs-> Appears in the browser after OAuth 2.0 redirect
Affected build rangeMicrosoft 365 / Entra ID (latest)Entra admin center documentation-> Applies to all recent builds of Microsoft 365 services
Registry key or OMA-URI involvedNoneMicrosoft Graph API documentation-> Error is service-specific, no registry involvement
Relevant service/endpoint URLhttps://login.microsoftonline.com/error?code=50020Browser redirect URL-> Redirects here after failed sign-in attempt
Log line signatureStatus=Failure, Error code=50020Entra admin center > Monitoring & health > Sign-in logs-> Filter by these values to identify affected entries

Log Files to Check

What This Error Actually Means

The error code AADSTS50020 indicates that during an OAuth 2.0 authentication flow, the identity provider (IdP) presented a user account that does not exist in the target Entra ID tenant. This error is raised by Azure Active Directory (Azure AD), now known as Entra ID, when it encounters a scenario where an external user attempts to access resources without proper provisioning or due to configuration issues. The error specifically highlights a mismatch between the user's identity provider and the target tenant's expectations.

Affected Versions and Scope

This error is observed in Microsoft 365 / Entra ID environments running on the latest builds. It affects scenarios where external users (B2B guests) attempt to access resources within a tenant that has not been properly configured to accept their identities. Tenants using only work or school accounts, or those with strict Conditional Access policies, are more prone to this error. Personal Microsoft Accounts (MSAs) attempting to access restricted applications will also trigger AADSTS50020.

Where To Look First: Logs and Event IDs

To diagnose this issue, start by examining the sign-in logs in the Entra admin center: Entra admin center > Monitoring & health > Sign-in logs. Filter these logs using: Status=Failure AND Error code=50020. Look for entries with the exact error string: AADSTS50020: User account from identity provider does not exist in tenant. Relevant Event IDs to monitor are 401 (unauthorized access) and 50020 (specific to this error). These events can be found in the Windows Security Event Log under: Microsoft-Windows-DirectoryServices-DirectoryService/Operational.

Root Causes

User Not Provisioned as a Guest

If an external user attempts to access your tenant without being invited, Entra ID will reject the request. This is common in B2B collaboration scenarios where users are not properly onboarded.

Home Tenant Issues

The error may occur if the user's home tenant has been disabled or deleted. Users in such cases cannot authenticate even within their own tenant, let alone access external resources.

Unsupported Account Type

Applications configured to only accept organizational accounts will block personal Microsoft Accounts (e.g., @outlook.com). This mismatch triggers AADSTS50020 when an MSA attempts access.

Cached Credentials with Expired UPN

If a user's UPN changes in their home tenant, cached credentials in browsers or authenticators may still reference the old UPN, causing authentication failures.

Fix Procedure

  1. Invite the User as a B2B Guest
  2. Use the Entra admin center to invite external users: Entra admin center > Users > All users > New user > Invite external user. Alternatively, use PowerShell: New-MgInvitation -InvitedUserEmailAddress '[email protected]' -InviteRedirectUrl 'https://myapps.microsoft.com' -SendInvitationMessage:$true
  3. Check Home Tenant Status
  4. If the user's home tenant is disabled, they must contact their IT admin. As a workaround, create a cloud-only account: New-MgUser -DisplayName "Guest User" -MailNickname guestuser -UserPrincipalName [email protected] -AccountEnabled $true
  5. Modify Application Settings
  6. Update the application's supported account types in Entra: Entra admin center > App registrations > [App Name] > Authentication > Supported account types > Accounts in any organizational directory and personal Microsoft accounts
  7. Adjust Cross-Tenant Access Policies
  8. Configure cross-tenant settings to allow access from the user's home tenant: Entra admin center > External Identities > Cross-tenant access settings > Organizational settings > Add organization
    Be cautious when modifying application settings, as changing supported account types can affect all users of that application.

Error Code Variants

Error CodeDescription
AADSTS50013User account is disabled in the home tenant.
AADSTS50079Invalid token audience, typically due to misconfigured application permissions.
AADSTS50020External user not provisioned or home tenant issues.

Verification

Post-resolution, verify successful sign-ins in: Entra admin center > Monitoring & health > Sign-in logs. Confirm that the affected user now shows a Status of Success. Additionally, check the application's usage logs to ensure proper access.

Prevention

Implement the following measures: - Regularly audit guest user invitations using New-MgInvitation. - Monitor tenant health via Get-MgTenantDetails. - Review and update Conditional Access policies to align with organizational needs. - Use Graph API monitoring tools like Invoke-MgGraphRequest -Method GET -Uri "https://graph.microsoft.com/v1.0/users?$filter=userType eq 'guest'&$select=userPrincipalName,accountEnabled" to track guest accounts. By following this guide, you can effectively troubleshoot and resolve AADSTS50020 errors in your Entra ID environment.

Sources & References

Related Guides

Get new error code fixes by email

Product-specific solutions for Intune, Autopilot, SCCM and Entra ID — straight to your inbox. No spam.