A password spray tries one or two common passwords against hundreds of accounts, so no single account fails often enough to lock, and per-user alerts stay silent. The evidence is still in Microsoft Entra ID: it sits across accounts, in the sign-in logs, as clusters of the same error code from the same network, user agent or application. This guide is the detection engineering runbook for Entra ID: which log tables to query, which ResultType codes mean a guessed password versus a wrong one, KQL you can adapt for Microsoft Sentinel or Log Analytics, the Identity Protection signals that confirm a hit, and how to tune the rules. It is for SOC analysts and detection engineers. Prevention and the wider attack are covered in the Password Spraying and Credential Stuffing Defence Guide, and what to do once a spray is confirmed is in the Password Spraying Attack Response Playbook.
This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.
Key takeaways
- Count accounts, not attempts: the signal is many distinct user principal names failing from one IP address, autonomous system or user agent in a short window. Microsoft's Sentinel rule alerts at five accounts failing from one IP against one application within 20 minutes.
- Query both sign-in tables: sprays against legacy protocols and token endpoints often land in
AADNonInteractiveUserSignInLogs, not onlySigninLogs. A rule that reads one table misses half the attack. - Some "failures" mean the password was right: ResultType 50074, 50076, 50079 and 53003 occur after the password has been accepted. From a spraying source, they mean a password compromise, even though no token was issued.
- Identity Protection fires on success only: the
passwordSprayrisk detection needs Microsoft Entra ID P2 and is raised when the attacker validates a password, not for failed attempts, so you still need your own failure-pattern rule. - Low and slow sprays defeat IP rules: residential proxies rotate addresses, so aggregate by autonomous system number, user agent and application over days, and look for regular timing and address-book ordering.
What a spray looks like in the logs
Microsoft's password spray investigation playbook lists the patterns to look for. Turn each into a field you can group by:
| Indicator (Microsoft playbook) | Sign-in log field | How to use it |
|---|---|---|
| Large number of failed sign-ins across accounts | ResultType, UserPrincipalName | dcount(UserPrincipalName) per source and time bin |
| Repetitive user agent, target application, IP block or location | UserAgent, AppDisplayName, IPAddress, AutonomousSystemNumber, LocationDetails | Group by each; a spray tool tends to reuse one user agent and one application |
| Failures in address-book (GAL) order | UserPrincipalName sorted by TimeGenerated | Alphabetical progression through accounts from one source |
| Regular timing between attempts | TimeGenerated | Low variance in the gap between attempts from one source |
| Correct password followed by failed MFA | ResultType 50074 or 50076, AuthenticationRequirement | Password compromise: high priority |
| Quick sign-in and sign-out in the same second | Success followed by sign-out | A guessed password being tested |
| Legacy protocol use | ClientAppUsed | Any value other than Browser or Mobile Apps and Desktop clients deserves scrutiny |
Legacy authentication matters most: Microsoft's Conditional Access documentation states that more than 99% of password spray attacks it analysed use legacy authentication protocols, which cannot do MFA. Federated tenants are different: for a domain federated to AD FS, failed passwords stay in the identity provider and only successful sign-ins appear in Entra, so collect AD FS events 411 and 342 (bad credentials), 516 (extranet lockout) and, on AD FS 2016 and later, 1203 (fresh credential validation error), with the audit level set to Verbose.
ResultType codes that drive the rules
ResultType is a string column in SigninLogs; 0 is success. Group the codes by what they tell you about the guessed password:
| Code | Microsoft meaning | Password correct? | Use in spray detection |
|---|---|---|---|
| 50126 | InvalidUserNameOrPassword | No | Core failure code; some volume is normal from user typos |
| 50053 | IdsLocked (smart lockout), or sign-in blocked from an IP with malicious activity | Unknown | Check the Failure reason: a malicious-IP block is Microsoft already seeing the source |
| 50034 | UserAccountNotFound | Not applicable | Sprays built from guessed or scraped name lists hit accounts that do not exist |
| 50055 / 50144 | Password expired (cloud / on-premises AD) | Yes, but expired | Counts as a guessed password on a stale account |
| 50057 | UserDisabled | Unknown | Disabled accounts in the target list suggest an old directory dump |
| 50074 / 50076 | Strong authentication required; user did not pass, or must use MFA | Yes | Password compromise stopped by MFA: reset the password |
| 50079 | Strong authentication enrolment required | Yes | Worst case: attacker may be offered MFA registration |
| 53003 | BlockedByConditionalAccess | Yes (Conditional Access runs after first factor) | Password compromise stopped by policy |
| 0 | Success | Yes | Account compromise: escalate immediately |
Microsoft's own Sentinel rule treats 50053, 50126 and 50055 as the failure set and a long list including 50074, 50076, 50079, 50158 and 53003 as "success" codes for the same reason: each shows the password was accepted. The codes behind conditional blocks are covered in the Conditional Access Block Troubleshooting Guide (AADSTS53003), and the wider code set in the Entra ID Sign-In and Audit Log Detection Guide.
Step 1: get the right data in
- Stream both user sign-in tables: in Entra diagnostic settings, send
SignInLogsandNonInteractiveUserSignInLogsto the Log Analytics workspace behind Sentinel. AddRiskyUsersandUserRiskEventsif you have P2. - Keep at least 30 days, ideally 90: low and slow sprays stretch over weeks, and a baseline of normal failure rates per application needs history.
- Add AD FS if federated: forward the AD FS Security log events listed above, or the failures will never reach Entra.
- Test ingestion: fail a sign-in on a test account through a browser and once through a non-interactive client, and confirm each arrives in the table you expect with ResultType 50126.
Step 2: the core KQL detections
These are starting points. Column names follow the Azure Monitor table reference; confirm them and the values in your own workspace before enabling, since connectors and schemas change.
Many accounts failing from one IP
let window = 20m;
let accountThreshold = 5;
union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(1d)
| where ResultType in ("50126", "50053", "50034")
| summarize Accounts = dcount(UserPrincipalName), Attempts = count(),
Apps = make_set(AppDisplayName, 10), Agents = make_set(UserAgent, 5),
ClientApps = make_set(ClientAppUsed, 5)
by IPAddress, bin(TimeGenerated, window), Type
| where Accounts >= accountThreshold
| order by Accounts desc
The thresholds mirror the defaults in Microsoft's "Password spray attack against Microsoft Entra ID application" analytics rule (five accounts, 20 minute window). That rule also discards IPs where more accounts succeed than fail, which removes busy shared egress points such as your own proxies.
Low and slow: aggregate by network and user agent
union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(7d)
| where ResultType in ("50126", "50053", "50034")
| summarize Accounts = dcount(UserPrincipalName), Attempts = count(),
IPs = dcount(IPAddress), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
by AutonomousSystemNumber, UserAgent
| extend AttemptsPerAccount = round(todouble(Attempts) / Accounts, 1)
| where Accounts >= 20 and AttemptsPerAccount <= 3
| order by Accounts desc
Many accounts, few attempts each and many IPs within one network or user agent is the shape of a spray through rotating proxies. Microsoft's Midnight Blizzard guidance for responders makes the point directly: with residential proxies, blocking indicator IP addresses is not enough. The 20-account threshold is ours; set it from your baseline.
Did the spray work?
let sprayIPs =
union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(1d)
| where ResultType in ("50126", "50053", "50034")
| summarize Accounts = dcount(UserPrincipalName) by IPAddress
| where Accounts >= 5
| project IPAddress;
union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(1d)
| where IPAddress in (sprayIPs)
| where ResultType in ("0", "50074", "50076", "50079", "53003", "50055", "50144")
| project TimeGenerated, UserPrincipalName, IPAddress, ResultType, AppDisplayName,
ClientAppUsed, ConditionalAccessStatus, AuthenticationRequirement, Type
Every row is either a compromised account (ResultType 0) or a compromised password. This query is the one to page on. Microsoft's playbook orders the follow-up the same way: successful sign-ins from attacker IPs first, then interrupted sign-ins (MFA challenges), then failures, then successes from other unknown IPs.
Legacy protocol sprays
union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(1d)
| where ClientAppUsed !in ("Browser", "Mobile Apps and Desktop clients", "")
| summarize Failures = countif(ResultType != "0"), Successes = countif(ResultType == "0"),
Accounts = dcount(UserPrincipalName) by ClientAppUsed, IPAddress
| where Accounts >= 5
If a Conditional Access policy already blocks legacy authentication, these attempts show 53003 with the password evaluated first, so they still tell you which passwords are known. See the Legacy Authentication and ROPC Retirement Guide.
Step 3: add Identity Protection signals
Microsoft Entra ID Protection adds detections built on Microsoft's own telemetry. The ones that matter for spraying:
| Detection | riskEventType | Timing | Licence (Microsoft docs) |
|---|---|---|---|
| Password spray | passwordSpray | Real-time or offline | P2 |
| Microsoft Entra threat intelligence | investigationsThreatIntelligence | Real-time or offline | Free or P1 |
| Anonymous IP address | anonymizedIPAddress | Real-time | Free or P1 |
| Unfamiliar sign-in properties | unfamiliarFeatures | Real-time | P2 |
| Malicious IP address | maliciousIPAddress | Offline | P2 |
| Atypical travel | unlikelyTravel | Real-time | P2 |
Availability: Microsoft documents that without P2, premium detections appear as "Additional risk detected" (generic) without detail.
AADUserRiskEvents
| where TimeGenerated > ago(7d)
| where RiskEventType in ("passwordSpray", "investigationsThreatIntelligence", "unfamiliarFeatures")
| project TimeGenerated, UserPrincipalName, RiskEventType, RiskLevel, RiskState,
DetectionTimingType, IpAddress, CorrelationId
Join on CorrelationId back to the sign-in to see which application and client the attacker used. Because passwordSpray fires only when the password was validated, treat every instance as at least a password compromise. Offline detections can arrive hours later, so do not close a spray incident until the offline window has passed.
Step 4: tune before you page anyone
- Known shared egress: VPN concentrators, secure web gateways and office NAT addresses show many users failing on a Monday morning. Keep them in a watchlist and raise their threshold rather than excluding them: attackers spray through compromised internal hosts too.
- Smart lockout noise: smart lockout locks after 10 failures in commercial tenants (3 in US Government) for 60 seconds at first, tracks familiar and unfamiliar locations separately, and ignores repeats of the last three bad passwords. Expect 50053 bursts from real users after a password change; they come from familiar locations and one account at a time.
- Applications with stale stored passwords: a mail client or script retrying an old password produces steady 50126 for one account from one device. One account is not a spray; route it to the help desk view, not the SOC.
- Penetration tests: agree source IPs and a time window in advance, and tag them rather than suppress the rule.
- Run in report mode for two weeks: create the analytics rules with incidents off, review every result with the identity team, then enable incident creation for the "did it work" rule first.
Triage a spray alert
- Scope the source: list every account the IP, ASN or user agent touched, with the ResultType for each. Those with 0, 50074, 50076, 50079, 53003, 50055 or 50144 go on the compromised-password list.
- Check privilege: any privileged role holder, break-glass account or user-based service account on that list is a major incident.
- Follow successes: for ResultType 0, pull the session's later activity: audit log changes, new authentication methods, mailbox rules, OAuth consents.
- Hand over: containment, password resets and blocking follow the Password Spraying Attack Response Playbook; this guide stops at detection.
Where identity fits: service accounts in a spray
User accounts used as service accounts are the usual winners of a spray: they rarely have MFA, are often excluded from Conditional Access and keep the same password for years. Microsoft's Conditional Access guidance notes that user-scoped policies do not block service principal calls and recommends Conditional Access for workload identities and managed identities instead. Run the "did it work" query filtered to your service account watchlist and treat any hit as critical. To find the accounts first, see How to Find Accounts Excluded From MFA and Conditional Access.
Measures that show it is working
- Coverage: share of user sign-in volume from both tables, plus AD FS where federated, reaching the SIEM (target 100%).
- Time to detect: minutes from the first failure in a spray to an incident, measured on a planned test.
- Compromised passwords per spray: accounts with a password-accepted code from a spraying source; trend it after blocking legacy authentication and banning common passwords.
- False positive rate: share of spray incidents closed as benign; when it rises above the target you agreed, retune thresholds or egress watchlists.
- Legacy authentication attempts: volume of non-browser, non-modern client sign-ins, which should fall to near zero.
Common failure patterns
- Interactive table only: the rule reads
SigninLogswhile the spray hits a non-interactive or legacy endpoint. - Treating 53003 and 50076 as blocked, so safe: the password worked. Without a reset, the attacker keeps it for a weaker path, such as an excluded account or legacy protocol.
- Relying on Identity Protection alone: it raises
passwordSprayonly on a validated password and needs P2, so failed sprays and the early phase go unseen. - IP blocklists as the main control: residential proxy sprays rotate addresses faster than lists update.
- Federated tenant, no AD FS logs: Entra shows only successes, so the spray looks like a handful of normal sign-ins.
- Per-account thresholds: "more than 10 failures for one user" is a brute-force rule and will never fire on a spray.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| MITRE ATT&CK | T1110.003 Password Spraying; T1078.004 Valid Accounts: Cloud Accounts | The technique detected, and the use of the account it yields |
| MITRE ATT&CK mitigations | M1032 Multi-factor Authentication; M1036 Account Use Policies; M1027 Password Policies | Controls that turn a guessed password into a blocked one |
| NIST SP 800-53 Rev 5 | AC-7 Unsuccessful Logon Attempts; SI-4 System Monitoring; AU-6 Audit Record Review, Analysis, and Reporting | Lockout, monitoring and log review |
| NIST CSF 2.0 | DE.CM-03; DE.AE-02 | Monitoring account activity and analysing adverse events |
| CIS Controls v8.1 | Control 8 Audit Log Management; Safeguard 6.3 Require MFA for Externally-Exposed Applications | Collection and the control that blunts a spray |
| ISO/IEC 27001:2022 Annex A | A.8.15 Logging; A.8.16 Monitoring activities; A.5.17 Authentication information | Logging, monitoring and password quality |
Practitioner checklist
- Stream SignInLogs and NonInteractiveUserSignInLogs to the SIEM and keep 90 days.
- Forward AD FS events 411, 342, 516 and 1203 at Verbose audit level if any domain is federated.
- Deploy a distinct-accounts-per-IP rule across both tables (start at five accounts in 20 minutes).
- Add a seven-day ASN and user agent rule for low and slow sprays.
- Page on any password-accepted code (0, 50074, 50076, 50079, 53003) from a spraying source.
- Ingest AADUserRiskEvents and alert on passwordSpray where P2 is licensed.
- Watchlist shared egress IPs and raise their thresholds instead of excluding them.
- Block legacy authentication with Conditional Access and trend the remaining attempts.
- Test the rules with a planned, authorised exercise and record time to detect.
Standards and references
- Microsoft Learn: Password spray investigation
- Microsoft Learn: What are risk detections?
- Microsoft Learn: Microsoft Entra authentication and authorization error codes
- Microsoft Learn: SigninLogs table reference
- Microsoft Sentinel (GitHub): Password spray attack against Microsoft Entra ID application
- Microsoft Learn: Protect user accounts from attacks with Microsoft Entra smart lockout
- Microsoft Learn: Block legacy authentication with Conditional Access
- MITRE ATT&CK: Brute Force: Password Spraying (T1110.003)
Related NHI Mgmt Group resources: Password Spraying and Credential Stuffing Defence Guide · Account Lockout and Brute-Force Protection Guide · KQL for Threat Hunting Guide · Microsoft Sentinel Guide · Entra ID Sign-In and Audit Log Detection Guide