VeriKQL by Kaushik Saha

Level 2 · Count and compare · Mission 2 of 5 · by Kaushik Saha

How many users?

Alert Spray or brute force? · Idea dcount

Commands here where · != · sort by · count · summarize · dcount · all commands

Briefing

A password spray tries one or two common passwords against many users, so it isn't locked out. A brute force tries many passwords against one user. Both show up as failures. The difference is how many users each address tried.

One idea: dcount counts different values

SigninLogs
| where ResultType != "0"
| summarize Failures = count(), Users = dcount(UserPrincipalName) by IPAddress
| sort by Failures desc
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 4 rows

IPAddressFailuresUsers
198.51.100.231212
203.0.113.4581
192.0.2.2033
192.0.2.1022

Read the two outside addresses:

  • 198.51.100.23: 12 failures across 12 users, one try each. That is a spray.
  • 203.0.113.45: 8 failures against one user. That is a brute force.

Your turn

For each user, count their failures and the number of different addresses they failed from.

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 Failures = count(), Addresses = dcount(IPAddress) by UserPrincipalName
| sort by Failures desc
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 12 rows

UserPrincipalNameFailuresAddresses
alex.morgan@contoso.com92
mei.chen@contoso.com22
ben.carter@contoso.com22
priya.nair@contoso.com22
sara.lind@contoso.com22
tom.becker@contoso.com22
raj.patel@contoso.com11
lena.fischer@contoso.com11
sam.okafor@contoso.com11
it.admin@contoso.com11
omar.haddad@contoso.com11
julia.santos@contoso.com11

Check your own query

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

Debrief

Two attacks, not one. And Alex appears in both: the spray tried Alex once at 07:40, and the brute force came back for Alex alone at 08:14. Next, keep only the addresses that look like a spray.

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.