Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | AADSTS50126: Invalid username or password | Sign-in screen/Event Viewer | Occurs during Azure AD authentication |
| Affected OS build | Windows 11 22H2 (22621.x) | winver | Confirmed on 22H2 baseline |
| Registry key | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AzureAD | Registry Editor | Check for misconfigured AAD policies |
| Service endpoint | https://login.microsoftonline.com | Entra ID documentation | Authentication endpoint URL |
| Log line signature | Event ID 4625 with AADSTS50126 | Security.evtx | Failed sign-in attempt log |
Log Files to Check
C:\Windows\System32\winevt\Logs\Security.evtxC:\ProgramData\Microsoft\Windows\Diagnosis\System\Security-S-1-5-18-C-<ID>.etl
What This Error Actually Means
The errorAADSTS50126: 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 onWindows 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 inC:\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
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 thePasswordLastSet 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 asAADSTS50126. 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 corruptedHKEY_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
- Reset the user's password via the
Entra ID admin center > Users > [User] > Reset passwordblade. UseSet-AzADUser -UserPrincipalName "[email protected]" -PasswordProfile $profilefor automation. - Unlock the account using
Set-MgUser -UserId "[email protected]" -AccountEnabled $trueifEvent ID 4740is present. - Repair device trust by re-registering the device via
Remove-AzADDevice -DeviceId "device-id"followed bydsregcmd /join. - Deploy a registry fix via Intune using OMA-URI
./Device/Vendor/MSFT/Registry/Machine/Software/Microsoft/AzureADto restore correctJoinTimeandDeviceIdvalues.
Avoid modifying
HKLM\SOFTWARE\Microsoft\AzureAD manually on enrolled devices, as this can break device trust and require re-enrollment.Error Code Variants
| Error Code | Description | Distinguishing Feature |
|---|---|---|
| AADSTS50126 | Invalid credentials | Occurs after successful directory lookup |
| AADSTS50057 | User account not found | No directory match for UPN |
| AADSTS50076 | Password expired | Accompanied by Event ID 4741 |
Verification
After applying fixes, confirm resolution by: 1. CheckingSecurity.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 viaEntra 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.