Understanding AADSTS Error Codes
AADSTS error codes appear on the Microsoft sign-in error page and in Azure AD sign-in logs. Each code maps to a specific failure category. The three most common codes you will encounter are described below.AADSTS50126 — Invalid Username or Password
AADSTS50126 — Invalid Username or Password
- User entered the wrong password
- The account’s password was recently changed and the user has not updated cached credentials
- Caps Lock is enabled
- The account is configured with a different UPN than the user expects (e.g.,
[email protected]vs.[email protected])
- Ask the user to verify their username (UPN) at
https://login.microsoftonline.com. - Initiate a self-service password reset (SSPR) at
https://aka.ms/ssprif the user has forgotten their password. - If SSPR is not enabled, reset the password from the Microsoft 365 admin centre → Users → Active Users → Reset password.
- Clear cached credentials in Credential Manager (Windows) or Keychain Access (macOS).
- If failures continue after a password reset, check that the account is not locked in Azure AD → Users → [User] → Sign-in logs — look for repeated AADSTS50126 entries that could trigger a smart lockout.
AADSTS50020 — Guest Account / Tenant Mismatch
AADSTS50020 — Guest Account / Tenant Mismatch
- A user from an external organisation (a “guest” user) tries to sign in to a tenant they have not been invited to
- A personal Microsoft account (MSA) is being used to access a tenant that only accepts work/school accounts
- The invited guest user has not yet accepted their invitation
- Verify whether the user is an internal user or an external guest. In Azure AD → Users, check the User type column (Member vs. Guest).
- If the user should be a guest, send a new B2B invitation via Azure AD → Users → New guest user with the correct external email address.
- Ask the external user to check their email inbox for the invitation and accept it before attempting to sign in.
- If the user is internal but receiving this error, verify their account is in the correct tenant and is not a duplicate or shadow account.
- Check whether the user is attempting to use a personal Microsoft account. If the tenant is configured to block personal accounts, the user must use their work/school account exclusively.
AADSTS700016 — Application Not Found in Tenant
AADSTS700016 — Application Not Found in Tenant
- In the Azure AD admin centre (
https://aad.portal.azure.com), navigate to Enterprise Applications and search for the application by name or application ID. - If the application is not listed, it has not been added to the tenant. Add it via Enterprise Applications → New Application and search the gallery, or add a custom application.
- If the application is listed but users cannot sign in, check the Properties blade: ensure Enabled for users to sign in is set to Yes.
- Review User and group assignments — if Assignment required is enabled, the user or a group they belong to must be explicitly assigned to the application.
- For first-party Microsoft applications, the service principal may need to be re-created. Contact Microsoft Support if this is suspected.
Reviewing Azure AD Sign-In Logs
Sign-in logs are your primary diagnostic tool for any Azure AD authentication failure.Open the Sign-in logs
https://aad.portal.azure.com), navigate to Monitoring → Sign-in logs (under Azure Active Directory).Filter by user and time range
Read the error details
- Error code: The AADSTS code
- Failure reason: Plain-language description
- Conditional Access: Whether a CA policy applied or blocked the sign-in
- Device: The device ID and join state at time of sign-in
Note the Correlation ID
Checking Conditional Access Policies
Conditional Access (CA) policies can block or restrict sign-in based on user, device, location, application, or risk signal. A blocked sign-in due to CA does not always produce a user-facing error — sometimes it silently fails or prompts the user to take an action (like enrolling a device) that they cannot complete.Navigate to Conditional Access
Use the What If tool
- The affected user’s account
- The target application
- The device platform and compliance state
- The sign-in risk level
Review individual policy conditions
- Users/Groups: Is the user included or excluded?
- Cloud apps: Does the policy apply to the application the user is trying to access?
- Conditions: Check device compliance, device join state, location (named locations/trusted IPs), and sign-in risk.
- Grant controls: What is required? (MFA, compliant device, hybrid join, approved client app)
Temporarily exclude the user for testing
Re-Joining a Device to Azure AD
If a device’s Azure AD trust relationship has broken — often after a reimaging, time sync failure, or Azure AD certificate expiry — users on that device may be unable to sign in even with correct credentials. Re-joining the device to Azure AD resolves this.Step 1: Check Current Device Join State
Run dsregcmd /status
- AzureAdJoined: YES — Device is Azure AD joined
- AzureAdJoined: NO — Device is not currently joined (needs to be joined)
- WorkplaceJoined: YES — Device is registered only (not a full Azure AD join)
- DomainJoined: YES alongside AzureAdJoined: YES — Device is hybrid-joined
dsregcmd /status as the signed-in domain user, not from an elevated prompt. User-state fields such as AzureAdPrt only populate in the user context. Running it elevated will show those fields as blank, which can mislead troubleshooting.Check the SSO and token state
dsregcmd /status, scroll to the User State and SSO State sections. Look for:AzureAdPrt: YES— Primary Refresh Token is valid (sign-in should work)AzureAdPrt: NO— PRT is missing or expired; re-join may be required
Step 2: Leave and Re-Join Azure AD
Leave Azure AD
Re-join Azure AD — Self-Service
Re-join Azure AD — Via Autopilot or MDM (enterprise)
Verify the new join state
dsregcmd /status again and confirm:AzureAdJoined: YESAzureAdPrt: YES
Escalation
Microsoft Entra ID Support
https://admin.microsoft.com → Support → New service request. Select Azure Active Directory / Microsoft Entra ID as the product. Provide the Correlation ID from the sign-in logs.Azure AD Sign-In Logs Export
Microsoft Entra Diagnostic Tool
https://entra.microsoft.com → Diagnose & solve problems to run automated checks for sign-in failures, CA policy issues, and MFA registration problems.Collect dsregcmd Output
dsregcmd /status to the ticket. Redact the device certificate thumbprint and any sensitive token values before sharing.