Entra ID sign-in error
AADSTS50126: Wrong username or password
AADSTS50126 means the username or password was wrong. Why it appears in every tenant's logs, the password sync case, and when it turns into a lockout.
AADSTS50126
Error validating credentials due to invalid username or password.
What it means
The username or password entered was wrong. Microsoft expects some of these in every tenant's logs, because people mistype. On a Microsoft Entra hybrid joined device with password hash sync, it can also follow a password change that has not reached Microsoft Entra ID yet.
Fix it: tenant admins
- Find the failed sign-in under
Entra ID > Monitoring & health > Sign-in logsand read the failure reason. Reports Reader is the least privileged role that can see the logs. - A few failures for one user are normal. Many failures across many accounts, or a steady run against one account, can mean password spray or brute force. Microsoft's security operations guide says to set a baseline for this code and alert above it.
- Repeated failures count towards smart lockout, which then returns AADSTS50053. The default threshold is 10 failed attempts in Azure Public tenants.
Fix it: app developers
- Apps that use the username and password flow (ROPC) should ask the user to enter the password again.
Fix it: the person signing in
- Type the username and password again, carefully.
- If you do not remember the password, stop guessing: repeated wrong attempts lock the account (AADSTS50053). Reset it with self-service password reset, or ask your IT team.
- If you changed your password on a domain-joined PC a short time ago, wait for it to sync to Microsoft Entra ID, then try again.
Related codes
Microsoft sources
- How to troubleshoot sign-in errors
- Prevent attacks using smart lockout
- Microsoft Entra authentication and authorization error codes (the full list)
- Microsoft's live lookup for 50126 (login.microsoftonline.com)
Find who is hitting AADSTS50126
Sign-in logs record the code without the AADSTS prefix: as status/errorCode in Microsoft Graph S04 and as ResultType in the SigninLogs table in Log Analytics S05. The SigninLogs and Microsoft Graph queries below cover interactive sign-ins. Non-interactive sign-ins are in the AADNonInteractiveUserSignInLogs table, which documents the error code in ResultSignature S41. If you query that table, test ResultType as well. For one failed sign-in, paste its error message into the lookup to get queries for its Correlation ID.
Log Analytics (KQL), last 7 days
SigninLogs
| where TimeGenerated > ago(7d) and ResultType == "50126"
| summarize Failures = count(), Last = max(TimeGenerated) by UserPrincipalName, AppDisplayName
| sort by Failures descMicrosoft Graph PowerShell, last 7 days
Connect-MgGraph -Scopes "AuditLog.Read.All"
$since = (Get-Date).ToUniversalTime().AddDays(-7).ToString("yyyy-MM-ddTHH:mm:ssZ")
Get-MgAuditLogSignIn -Filter "status/errorCode eq 50126 and createdDateTime ge $since" -All |
Select-Object CreatedDateTime, UserPrincipalName, AppDisplayName, CorrelationIdReading sign-in logs needs at least the Reports Reader role S06; the Graph call needs the AuditLog.Read.All permission S42, and -All returns every page of results S69.
Sources for this page
Microsoft's description is quoted from the Microsoft Entra error code reference; it is Microsoft's text and is not covered by our CC BY 4.0 licence. The cause and fix steps are our own wording, published under CC BY 4.0; each source below is the Microsoft page they rest on, with the passage we checked. Rules for every page are in the methodology.
S01. Microsoft (Microsoft Learn), Microsoft Entra authentication and authorization error codes. Retrieved 2026-11-25.
Expect to see some number of these errors in your logs due to users making mistakes.
Error codes are subject to change at any time in order to provide more granular error messages
Error codes and messages are subject to change. For the most current info, take a look at the
You can also link directly to a specific error by adding the error code number to the URL
S06. Microsoft (Microsoft Learn), How to troubleshoot sign-in errors. Retrieved 2026-11-25.
Reports Reader is the least privileged role required to access the activity logs.
any user can access their own sign-ins from https://mysignins.microsoft.com.
A common failure reason is Error validating credentials due to invalid username or password. The user entered something incorrectly and needs to try again.
S44. Microsoft (Microsoft Learn), Prevent Attacks Using Smart Lockout. Retrieved 2026-11-25.
10 failed attempts in Azure Public and Microsoft Azure operated by 21Vianet tenants
S51. Microsoft (Microsoft Learn), Troubleshoot primary refresh token issues on Windows devices. Retrieved 2026-11-25.
To acquire a fresh PRT that has the new credentials, wait for the Microsoft Entra synchronization to finish.
S52. Microsoft (Microsoft Learn), Acquire a token to call a web API using username and password (desktop app). Retrieved 2026-11-25.
Mitigation: ask the user to re-enter the password
S49. Microsoft (Microsoft Learn), Microsoft Entra security operations for user accounts. Retrieved 2026-11-25.
many failed authentications can indicate that a bad actor is trying to obtain access.
Define a baseline threshold, and then monitor and adjust to suit your organizational behaviors
S04. Microsoft (Microsoft Learn, Microsoft Graph), signIn resource type. Retrieved 2026-11-25.
Supports $filter (eq) on errorCode property.
The request ID sent from the client when the sign-in is initiated. Used to troubleshoot sign-in activity.
S05. Microsoft (Microsoft Learn, Azure Monitor), Azure Monitor Logs reference - SigninLogs. Retrieved 2026-11-25.
Provides the 5-6 digit error code that's generated during a sign-in event. 0 indicates success; other values are failures.
The identifier that's sent from the client when sign-in is initiated.
S41. Microsoft (Microsoft Learn, Azure Monitor), Azure Monitor Logs reference - AADNonInteractiveUserSignInLogs. Retrieved 2026-11-25.
Contains the error code, if any, for the sign-in operation.
S42. Microsoft (Microsoft Learn, Microsoft Graph), List signIns. Retrieved 2026-11-25.
To avoid having the request time out, apply the $filter parameter with a time range for which to get all sign-ins
Sign-ins that are interactive in nature
S69. Microsoft (Microsoft Learn, Microsoft Graph PowerShell), Get-MgAuditLogSignIn (Microsoft.Graph.Reports). Retrieved 2026-11-25.
-All List all pages.
