VeriKQL by Kaushik Saha

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
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 7 rows

TimeGeneratedCityCountryIPAddressAppDisplayName
2026-06-10 07:56:42SeattleUS192.0.2.10Microsoft Teams
2026-06-10 08:12:33SeattleUS192.0.2.10Office 365 Exchange Online
2026-06-10 08:20:36AmsterdamNL203.0.113.45Office 365 Exchange Online
2026-06-10 08:24:10AmsterdamNL203.0.113.45Microsoft Graph PowerShell
2026-06-10 09:02:41AmsterdamNL203.0.113.45Azure Portal
2026-06-10 09:08:19AmsterdamNL203.0.113.77Office 365 SharePoint Online
2026-06-10 09:58:44AmsterdamNL203.0.113.77Azure 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
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 25 rows, the first 16 shown

UserPrincipalNameCity
alex.morgan@contoso.comAmsterdam
alex.morgan@contoso.comSeattle
alex.morgan@contoso.comFrankfurt am Main
ben.carter@contoso.comLondon
ben.carter@contoso.comFrankfurt am Main
it.admin@contoso.comSeattle
it.admin@contoso.comFrankfurt am Main
julia.santos@contoso.comSeattle
julia.santos@contoso.comFrankfurt am Main
lena.fischer@contoso.comFrankfurt am Main
lena.fischer@contoso.comLondon
mei.chen@contoso.comSeattle
mei.chen@contoso.comFrankfurt am Main
omar.haddad@contoso.comSeattle
omar.haddad@contoso.comFrankfurt am Main
priya.nair@contoso.comFrankfurt 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.