VeriKQL by Kaushik Saha

Level 3 · Did they get in? · Mission 3 of 5 · by Kaushik Saha

Last seen

Alert Failures, then a success · Idea arg_max

Commands here where · == · and / or · startswith · sort by · summarize · arg_max · all commands

Briefing

A SOC lead's first two questions: when did it start, and is it still going on? Find the last time each attacker address was seen.

One idea: arg_max keeps the whole row with the largest value

SigninLogs
| where IPAddress startswith "203.0.113." or IPAddress startswith "198.51.100."
| summarize arg_max(TimeGenerated, UserPrincipalName, AppDisplayName, ResultType) by IPAddress
| sort by TimeGenerated asc
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 3 rows

IPAddressTimeGeneratedUserPrincipalNameAppDisplayNameResultType
198.51.100.232026-06-10 07:46:58it.admin@contoso.comOffice 365 Exchange Online50126
203.0.113.452026-06-10 09:02:41alex.morgan@contoso.comAzure Portal0
203.0.113.772026-06-10 09:58:44alex.morgan@contoso.comAzure Storage0

Three outside addresses, not two. The spray stops at 07:46. 203.0.113.45 is last seen at 09:02 in the Azure portal. And a new one, 203.0.113.77, is still signing in as Alex at 09:58, to Azure Storage.

Your turn

For each user, show their latest successful sign-in, with the time, the address and the app.

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 arg_max(TimeGenerated, IPAddress, AppDisplayName) by UserPrincipalName
| sort by UserPrincipalName asc
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 12 rows

UserPrincipalNameTimeGeneratedIPAddressAppDisplayName
alex.morgan@contoso.com2026-06-10 09:58:44203.0.113.77Azure Storage
ben.carter@contoso.com2026-06-10 10:11:38192.0.2.20Microsoft Teams
it.admin@contoso.com2026-06-10 11:47:01192.0.2.10Azure Portal
julia.santos@contoso.com2026-06-10 10:21:24192.0.2.10Office 365 SharePoint Online
lena.fischer@contoso.com2026-06-10 10:06:53192.0.2.20Office 365 Exchange Online
mei.chen@contoso.com2026-06-10 10:18:40192.0.2.10Office 365 Exchange Online
omar.haddad@contoso.com2026-06-10 10:28:30192.0.2.34My Apps
priya.nair@contoso.com2026-06-10 10:21:42192.0.2.10Microsoft Teams
raj.patel@contoso.com2026-06-10 10:27:32192.0.2.41Office 365 SharePoint Online
sam.okafor@contoso.com2026-06-10 10:25:28192.0.2.10Office 365 SharePoint Online
sara.lind@contoso.com2026-06-10 11:02:40192.0.2.20Office 365 Exchange Online
tom.becker@contoso.com2026-06-10 10:10:42192.0.2.20Office 365 SharePoint Online

Check your own query

Write your query for the task above and check it against the real schema.

Debrief

The attacker changed address after getting in. Level 5 follows what they did; first, one more check that makes this a detection.

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.