Level 3 · Did they get in? · Mission 1 of 5 · by Kaushik Saha
Failures and successes
Alert Failures, then a success · Idea countif
Commands here == · != · sort by · summarize · countif · all commands
Briefing
Two attacks hit Contoso this morning: a spray from 198.51.100.23 and a brute force on Alex from 203.0.113.45.
Failures are noise until one of them turns into a success. Did either attack get in?
One idea: countif counts only the rows that match
Two countifs in one summarize put failures and successes side by side:
SigninLogs
| summarize Failures = countif(ResultType != "0"), Successes = countif(ResultType == "0") by IPAddress
| sort by Failures desc
Result on the sample · 7 rows
| IPAddress | Failures | Successes |
|---|---|---|
| 198.51.100.23 | 12 | 0 |
| 203.0.113.45 | 8 | 3 |
| 192.0.2.20 | 3 | 39 |
| 192.0.2.10 | 2 | 54 |
| 192.0.2.34 | 0 | 9 |
| 203.0.113.77 | 0 | 2 |
| 192.0.2.41 | 0 | 9 |
The spray: 12 failures and no success. The brute force: 8 failures and 3 successes. One attack got in.
Your turn
For each user, count their failures and their successes, and show the users with the most failures first.
Write it in the box below and check it. Then compare with one answer; others can be right too.
Show one answer
SigninLogs
| summarize Failures = countif(ResultType != "0"), Successes = countif(ResultType == "0") by UserPrincipalName
| sort by Failures desc
Result on the sample · 12 rows
| UserPrincipalName | Failures | Successes |
|---|---|---|
| alex.morgan@contoso.com | 9 | 7 |
| mei.chen@contoso.com | 2 | 10 |
| priya.nair@contoso.com | 2 | 10 |
| ben.carter@contoso.com | 2 | 10 |
| sara.lind@contoso.com | 2 | 10 |
| tom.becker@contoso.com | 2 | 10 |
| raj.patel@contoso.com | 1 | 9 |
| omar.haddad@contoso.com | 1 | 9 |
| julia.santos@contoso.com | 1 | 9 |
| lena.fischer@contoso.com | 1 | 9 |
| it.admin@contoso.com | 1 | 14 |
| sam.okafor@contoso.com | 1 | 9 |
Check your own query
Write your query for the task above and check it against the real schema.
Debrief
A failure count says someone tried. A success from the same address says someone got in. Next: exactly when?
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.