Level 2 · Count and compare · Mission 1 of 5 · by Kaushik Saha
Count by address
Alert Spray or brute force? · Idea summarize · count
Commands here where · != · sort by · count · summarize · all commands
Briefing
Level 1 ended with a question. Alex's password was guessed from 203.0.113.45, but at 07:40 another address,
198.51.100.23, failed against almost everyone. One attacker, or two? Start by counting.
One idea: summarize ... by gives one row per group
Instead of reading 25 failures one by one, count them per address:
SigninLogs
| where ResultType != "0"
| summarize Failures = count() by IPAddress
| sort by Failures desc
Result on the sample · 4 rows
| IPAddress | Failures |
|---|---|
| 198.51.100.23 | 12 |
| 203.0.113.45 | 8 |
| 192.0.2.20 | 3 |
| 192.0.2.10 | 2 |
Four addresses. Two are Contoso's own offices (192.0.2.x) with a few everyday failures. Two are not, and they fail
far more often.
Your turn
Count the failed sign-ins per user, most first.
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() by UserPrincipalName
| sort by Failures desc
Result on the sample · 12 rows
| UserPrincipalName | Failures |
|---|---|
| alex.morgan@contoso.com | 9 |
| mei.chen@contoso.com | 2 |
| ben.carter@contoso.com | 2 |
| priya.nair@contoso.com | 2 |
| sara.lind@contoso.com | 2 |
| tom.becker@contoso.com | 2 |
| raj.patel@contoso.com | 1 |
| lena.fischer@contoso.com | 1 |
| sam.okafor@contoso.com | 1 |
| it.admin@contoso.com | 1 |
| omar.haddad@contoso.com | 1 |
| julia.santos@contoso.com | 1 |
Check your own query
Write your query for the task above and check it against the real schema.
Debrief
Counting turns a long list into a short answer. But a count alone can't tell a spray from a brute force: both fail a lot. Next, count who each address tried.
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.