VeriKQL by Kaushik Saha

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

Result on the sample · 7 rows

IPAddressFailuresSuccesses
198.51.100.23120
203.0.113.4583
192.0.2.20339
192.0.2.10254
192.0.2.3409
203.0.113.7702
192.0.2.4109

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

Result on the sample · 12 rows

UserPrincipalNameFailuresSuccesses
alex.morgan@contoso.com97
mei.chen@contoso.com210
priya.nair@contoso.com210
ben.carter@contoso.com210
sara.lind@contoso.com210
tom.becker@contoso.com210
raj.patel@contoso.com19
omar.haddad@contoso.com19
julia.santos@contoso.com19
lena.fischer@contoso.com19
it.admin@contoso.com114
sam.okafor@contoso.com19

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.