Level 4 · Same user, two countries · Mission 1 of 5 · by Kaushik Saha
Where were they?
Alert Impossible travel · Idea dot notation · tostring · extend
Commands here project · distinct · where · == · and / or · sort by · extend · tostring · dot notation · all commands
Briefing
The attacker got in at 08:20. But Alex says they were at their desk in Seattle all morning. Where did each sign-in come from?
One idea: read inside a dynamic column with dot notation
LocationDetails holds a small JSON document for each sign-in: the city, the state, the country and the coordinates.
A dot reads one field, and tostring turns it into text:
SigninLogs
| where UserPrincipalName == "alex.morgan@contoso.com" and ResultType == "0"
| extend City = tostring(LocationDetails.city), Country = tostring(LocationDetails.countryOrRegion)
| sort by TimeGenerated asc
| project TimeGenerated, City, Country, IPAddress, AppDisplayName
Result on the sample · 7 rows
| TimeGenerated | City | Country | IPAddress | AppDisplayName |
|---|---|---|---|---|
| 2026-06-10 07:56:42 | Seattle | US | 192.0.2.10 | Microsoft Teams |
| 2026-06-10 08:12:33 | Seattle | US | 192.0.2.10 | Office 365 Exchange Online |
| 2026-06-10 08:20:36 | Amsterdam | NL | 203.0.113.45 | Office 365 Exchange Online |
| 2026-06-10 08:24:10 | Amsterdam | NL | 203.0.113.45 | Microsoft Graph PowerShell |
| 2026-06-10 09:02:41 | Amsterdam | NL | 203.0.113.45 | Azure Portal |
| 2026-06-10 09:08:19 | Amsterdam | NL | 203.0.113.77 | Office 365 SharePoint Online |
| 2026-06-10 09:58:44 | Amsterdam | NL | 203.0.113.77 | Azure Storage |
Seattle until 08:12. Amsterdam from 08:20. Same account, two countries, eight minutes apart.
Your turn
For every user, show each different city they signed in from, using LocationDetails.city.
Write it in the box below and check it. Then compare with one answer; others can be right too.
Show one answer
SigninLogs
| extend City = tostring(LocationDetails.city)
| distinct UserPrincipalName, City
| sort by UserPrincipalName asc
Result on the sample · 25 rows, the first 16 shown
| UserPrincipalName | City |
|---|---|
| alex.morgan@contoso.com | Amsterdam |
| alex.morgan@contoso.com | Seattle |
| alex.morgan@contoso.com | Frankfurt am Main |
| ben.carter@contoso.com | London |
| ben.carter@contoso.com | Frankfurt am Main |
| it.admin@contoso.com | Seattle |
| it.admin@contoso.com | Frankfurt am Main |
| julia.santos@contoso.com | Seattle |
| julia.santos@contoso.com | Frankfurt am Main |
| lena.fischer@contoso.com | Frankfurt am Main |
| lena.fischer@contoso.com | London |
| mei.chen@contoso.com | Seattle |
| mei.chen@contoso.com | Frankfurt am Main |
| omar.haddad@contoso.com | Seattle |
| omar.haddad@contoso.com | Frankfurt am Main |
| priya.nair@contoso.com | Frankfurt am Main |
Check your own query
Write your query for the task above and check it against the real schema.
Debrief
The plain Location column only says the country; LocationDetails adds the city and the coordinates you'll need to
measure the distance. Next, find every user who did this, not only Alex.
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.