Level 2 · Count and compare · Mission 2 of 5 · by Kaushik Saha
How many users?
Alert Spray or brute force? · Idea dcount
Commands here where · != · sort by · count · summarize · dcount · all commands
Briefing
A password spray tries one or two common passwords against many users, so it isn't locked out. A brute force tries many passwords against one user. Both show up as failures. The difference is how many users each address tried.
One idea: dcount counts different values
SigninLogs
| where ResultType != "0"
| summarize Failures = count(), Users = dcount(UserPrincipalName) by IPAddress
| sort by Failures desc
Result on the sample · 4 rows
| IPAddress | Failures | Users |
|---|---|---|
| 198.51.100.23 | 12 | 12 |
| 203.0.113.45 | 8 | 1 |
| 192.0.2.20 | 3 | 3 |
| 192.0.2.10 | 2 | 2 |
Read the two outside addresses:
198.51.100.23: 12 failures across 12 users, one try each. That is a spray.203.0.113.45: 8 failures against one user. That is a brute force.
Your turn
For each user, count their failures and the number of different addresses they failed from.
Write it in the box below and check it. Then compare with one answer; others can be right too.
Show one answer
SigninLogs
| where ResultType != "0"
| summarize Failures = count(), Addresses = dcount(IPAddress) by UserPrincipalName
| sort by Failures desc
Result on the sample · 12 rows
| UserPrincipalName | Failures | Addresses |
|---|---|---|
| alex.morgan@contoso.com | 9 | 2 |
| mei.chen@contoso.com | 2 | 2 |
| ben.carter@contoso.com | 2 | 2 |
| priya.nair@contoso.com | 2 | 2 |
| sara.lind@contoso.com | 2 | 2 |
| tom.becker@contoso.com | 2 | 2 |
| raj.patel@contoso.com | 1 | 1 |
| lena.fischer@contoso.com | 1 | 1 |
| sam.okafor@contoso.com | 1 | 1 |
| it.admin@contoso.com | 1 | 1 |
| omar.haddad@contoso.com | 1 | 1 |
| julia.santos@contoso.com | 1 | 1 |
Check your own query
Write your query for the task above and check it against the real schema.
Debrief
Two attacks, not one. And Alex appears in both: the spray tried Alex once at 07:40, and the brute force came back for Alex alone at 08:14. Next, keep only the addresses that look like a spray.
All data on this page is sample data, made up for this course. The IP addresses come from ranges reserved for documentation, and the people and the company are fictional.
Mission by Kaushik Saha. Every query checked with Microsoft.Azure.Kusto.Language 12.4.1 against schema bundle 2026.10.29; every result computed on the course's sample with Kusto-Loco 1.4.9, an open-source KQL engine (credits). The story's clock reads 12:00 UTC on 10 June 2026.