Before you run
Data & scope
- Required tables
- Time window
- 24 hours, grouped into 15-minute windows
- Microsoft Entra ID connector with SigninLogs selected and at least 24 hours of complete collection.
- Microsoft Entra ID P1 or P2 for sign-in ingestion and access to query this workspace.
Documentation review by Codex (AI). No live-tenant execution or detection-performance claim. Validate schema, data coverage and expected results in your workspace.
// Hunting starter. Documentation checked 2026-11-13; not tenant-tested.
let minimumUsers = 10;
SigninLogs
| where TimeGenerated >= ago(1d) and TimeGenerated <= now()
| where ResultType == "50126"
| where isnotempty(AADTenantId) and isnotempty(UserId) and isnotempty(IPAddress)
| summarize FailureRows = count(), FirstSeen = min(TimeGenerated),
LastSeen = max(TimeGenerated), UserName = take_any(UserPrincipalName)
by AADTenantId, IPAddress, AppId, WindowStart = bin(TimeGenerated, 15m), UserId
| summarize TargetUsers = count(), FailureRows = sum(FailureRows),
FirstSeen = min(FirstSeen), LastSeen = max(LastSeen),
UserSamples = make_set(UserName, 10)
by AADTenantId, IPAddress, AppId, WindowStart
| where TargetUsers >= minimumUsers
| order by TargetUsers desc, FailureRows desc
| take 200
Read-only query. Run in your own authorized workspace after checking prerequisites.
This hunt looks for a particular pattern: many resolved user identities receive invalid-credential failures from one logged source address against one application within a short window. It is useful when investigating a shared authentication failure signal, including access to AI administration tools. A result is a candidate for investigation, not a finding that an attacker attempted the same password.
What the threshold measures
The query selects error 50126, whose documented meaning is an invalid username or password. It does not include every failed or interrupted sign-in, which would mix authentication mistakes with unrelated access-policy outcomes. Error-code reference.
The first aggregation produces one row per directory, user, address, application and 15-minute window. The second counts those user rows exactly. FailureRows counts ingested records, while TargetUsers counts distinct resolved user IDs in that group. Missing user IDs are intentionally excluded, so attempted usernames that never resolve to an object are outside this hunt. The ten-user threshold is an illustrative starting point that requires local validation.
Investigate the shared source
Retrieve raw events around the window and compare application identifiers, user agents, device context and timestamps. Determine whether the address belongs to an office, proxy, VPN, identity broker or other shared infrastructure. Several legitimate users behind the same egress can produce the same pattern during a password synchronization issue.
Investigate successful and interrupted authentication for the affected identities separately. Do not equate a successful sign-in from that address with attacker success; retain user and application context when correlating. Microsoft’s investigation playbook provides a broader response sequence.
Tune without hiding the population
Start with a known normal period and review whether the candidate users share an operational cause. A documented exception should identify the approved population and service, have an owner, and expire. Suppressing a whole cloud provider or corporate egress indefinitely creates a broad blind spot.
A fixed bin can split activity across a boundary, and distributed or slow attempts can stay below the threshold. The 200-row cap applies after aggregation; it limits displayed groups, not scanned input. This documentation-checked hunt has not been executed in a tenant. Validate with synthetic records covering ten different users, repeated failures for one user, an unresolved identity, and events straddling a time boundary. Confirm collection health before treating empty output as reassuring.
Verify the source
Microsoft references
Measure normal activity, validate known test cases, account for ingestion delays, choose a threshold and entity mapping, and assign an owner. Results require investigation.
Follow the detection learning path →