Level 4 · Same user, two countries · Mission 5 of 5 · by Kaushik Saha
Level 4 bug hunt
Alert Impossible travel · Idea fix it
Commands here where · == · count · summarize · extend · tostring · dot notation · all commands
Briefing
A colleague's per-country count won't compile. Two mistakes, both about the nested column.
SigninLogs
| where ResultType == "0"
| extend Country = LocationDetails.countryOrRegion, City = LocationDetail.city
| summarize SignIns = count() by UserPrincipalName, Country
Hint: one is a spelling mistake; the other is a dynamic value used where only a plain value can go.
Your turn
Fix the query so it compiles and counts each user's successful sign-ins per country.
Paste the query into the box, check it and fix what the checker reports. Then compare with one answer.
Show one answer
SigninLogs
| where ResultType == "0"
| extend Country = tostring(LocationDetails.countryOrRegion), City = tostring(LocationDetails.city)
| summarize SignIns = count() by UserPrincipalName, Country
Result on the sample · 13 rows
| UserPrincipalName | Country | SignIns |
|---|---|---|
| mei.chen@contoso.com | US | 10 |
| omar.haddad@contoso.com | US | 9 |
| julia.santos@contoso.com | US | 9 |
| priya.nair@contoso.com | US | 10 |
| lena.fischer@contoso.com | GB | 9 |
| it.admin@contoso.com | US | 14 |
| ben.carter@contoso.com | GB | 10 |
| sara.lind@contoso.com | GB | 10 |
| tom.becker@contoso.com | GB | 10 |
| alex.morgan@contoso.com | NL | 5 |
| sam.okafor@contoso.com | US | 9 |
| raj.patel@contoso.com | GB | 9 |
| alex.morgan@contoso.com | US | 2 |
Check your own query
The broken query is in the box: check it, fix what the checker reports and check it again.
Level 4 cleared
Level 4 clue · pinned to the incident
Impossible travel. Alex signed in from Seattle at 08:12:33 and from Amsterdam at 08:20:36: 7,826 km in eight minutes. The Amsterdam sign-in was the attacker, with a password guessed from 203.0.113.45.
You can now read nested fields, count different values, subtract times and measure distances. Level 5 follows the attacker after 08:20: what did they open, and how did they get past MFA?
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.