Home › Entra ID › AADSTS50126

Entra ID · AADSTS50126 · Windows 11 22H2

Entra ID AADSTS50126 Error on Windows 11 22H2: Authentication Failure with Correct UPN

Root cause: Password expiration or account lockout. Fix: Reset password, verify MFA status, and check Entra ID sign-in logs for policy conflicts.

Error Details

FactValueSourceNote
Exact error stringAADSTS50126: Invalid username or passwordSign-in screen/Event ViewerOccurs during Azure AD authentication
Affected OS buildWindows 11 22H2 (22621.x)winverConfirmed on 22H2 baseline
Registry keyHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AzureADRegistry EditorCheck for misconfigured AAD policies
Service endpointhttps://login.microsoftonline.comEntra ID documentationAuthentication endpoint URL
Log line signatureEvent ID 4625 with AADSTS50126Security.evtxFailed sign-in attempt log

Log Files to Check

What This Error Actually Means

The error AADSTS50126: Invalid username or password is a client-side authentication failure raised by the Azure Active Directory (AAD) authentication service during sign-in attempts. The hexadecimal prefix AADSTS denotes an Azure AD status code, with 50126 specifically indicating that the provided credentials (username/password pair) do not match any valid account in the directory. This error is typically triggered by the Microsoft Online Services Sign-in API (MSOLSIGNIN) when a user attempts to authenticate via the https://login.microsoftonline.com endpoint. Unlike server-side errors (e.g., AADSTS50034), this code confirms the authentication request reached the AAD service but failed due to incorrect credentials. However, this error can also mask deeper issues such as account lockouts, password synchronization delays, or misconfigured device trust policies.

Affected Versions and Scope

This error is observed on Windows 11 22H2 (22621.x) devices enrolled in Azure AD, particularly those using hybrid Azure AD join or password hash synchronization. Tenants using conditional access policies that block legacy authentication protocols (e.g., NTLM) may see this error if clients are not using modern authentication (OAuth 2.0). The error is **not** observed on devices using pass-through authentication or password writeback, as these methods bypass local credential validation. Additionally, devices running Windows 11 22H2 with outdated Group Policy configurations (e.g., missing HKLM\SOFTWARE\Microsoft\AzureAD registry keys) are more prone to this issue. Tenants using Azure AD Premium P2 licenses with self-service password reset (SSPR) enabled are less likely to encounter this error due to proactive password expiration notifications.

Where To Look First: Logs and Event IDs

The primary diagnostic artifacts are located in C:\Windows\System32\winevt\Logs\Security.evtx and C:\ProgramData\Microsoft\Windows\Diagnosis\System\Security-S-1-5-18-C-.etl. Use Event Viewer to filter for Event ID 4625 (failed logon) with the string AADSTS50126 in the XML data. Example log line: ```xml AADSTS50126: Invalid username or password ``` For real-time analysis, use Get-WinEvent -LogName Security | Where-Object { $_.Id -eq 4625 -and $_.Message -match "AADSTS50126" }. Additionally, check Event ID 4740 (account lockout) to rule out secondary causes. The dsregcmd /status output can confirm Azure AD registration state, and Get-MgUser -UserId "[email protected]" can validate account existence in the directory.

Root Causes

1. Incorrect Password Entry

The most common cause is a user entering an incorrect password. This can be confirmed by cross-checking the PasswordLastSet property via Get-AzADUser -UserPrincipalName "[email protected]" | Select-Object PasswordLastSet. If the password was recently changed, ensure the user is aware of the update.

2. Account Lockout Due to Failed Attempts

Excessive failed sign-in attempts can trigger account lockout, which manifests as AADSTS50126. Check Event ID 4740 in the Security log to confirm lockout status. Use Get-MgUser -UserId "[email protected]" | Select-Object AccountEnabled to verify the account is unlocked.

3. Misconfigured Device Trust Policy

Devices with corrupted HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AzureAD registry keys may fail authentication even with correct credentials. Validate registry values using Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\AzureAD" | Format-List. Missing or incorrect values for JoinTime or DeviceId indicate misconfiguration.

Fix Procedure

  1. Reset the user's password via the Entra ID admin center > Users > [User] > Reset password blade. Use Set-AzADUser -UserPrincipalName "[email protected]" -PasswordProfile $profile for automation.
  2. Unlock the account using Set-MgUser -UserId "[email protected]" -AccountEnabled $true if Event ID 4740 is present.
  3. Repair device trust by re-registering the device via Remove-AzADDevice -DeviceId "device-id" followed by dsregcmd /join.
  4. Deploy a registry fix via Intune using OMA-URI ./Device/Vendor/MSFT/Registry/Machine/Software/Microsoft/AzureAD to restore correct JoinTime and DeviceId values.
  5. Avoid modifying HKLM\SOFTWARE\Microsoft\AzureAD manually on enrolled devices, as this can break device trust and require re-enrollment.

Error Code Variants

Error CodeDescriptionDistinguishing Feature
AADSTS50126Invalid credentialsOccurs after successful directory lookup
AADSTS50057User account not foundNo directory match for UPN
AADSTS50076Password expiredAccompanied by Event ID 4741

Verification

After applying fixes, confirm resolution by: 1. Checking Security.evtx for absence of Event ID 4625 with AADSTS50126. 2. Using Get-MgUser -UserId "[email protected]" | Select-Object PasswordPolicies to ensure None is set (no expired password). 3. Validating device trust via Get-AzADDevice -DeviceId "device-id" in the Entra ID portal.

Prevention

To prevent recurrence: - Enforce password complexity policies via Entra ID > Passwords > Password policies. - Deploy Intune device compliance policies with DeviceHealth baselines to monitor registry integrity. - Enable SSPR in Entra ID > Passwords > Self-service password reset to reduce password-related lockouts.
Use Get-WinEvent -LogName "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin" to preemptively identify devices with misconfigured Azure AD settings.

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.