Level 0 · Your toolkit · Card 2 of 9 · by Kaushik Saha
Filter rows
Commands where · == · != · =~ · and · or
What these commands do
| Command | What it does | Shape |
|---|---|---|
where | Keeps the rows where a condition is true | T | where Col == "value" |
== | Equals, exactly (case matters) | Col == "value" |
!= | Is not equal | Col != "value" |
=~ | Equals, ignoring upper and lower case | Col =~ "VALUE" |
and / or | Both conditions must be true / either one may be | A == 1 and B == 2 |
See them work
Every sign-in that didn't succeed, from one address:
SigninLogs
| where ResultType != "0" and IPAddress == "203.0.113.45"
| project TimeGenerated, UserPrincipalName, ResultType
Result on the sample · 8 rows
| TimeGenerated | UserPrincipalName | ResultType |
|---|---|---|
| 2026-06-10 08:17:05 | alex.morgan@contoso.com | 50126 |
| 2026-06-10 08:19:44 | alex.morgan@contoso.com | 500121 |
| 2026-06-10 08:15:10 | alex.morgan@contoso.com | 50126 |
| 2026-06-10 08:14:02 | alex.morgan@contoso.com | 50126 |
| 2026-06-10 08:19:12 | alex.morgan@contoso.com | 50126 |
| 2026-06-10 08:16:31 | alex.morgan@contoso.com | 50126 |
| 2026-06-10 08:18:41 | alex.morgan@contoso.com | 50126 |
| 2026-06-10 08:20:09 | alex.morgan@contoso.com | 500121 |
=~ finds the user however the name is typed:
SigninLogs
| where UserPrincipalName =~ "Alex.Morgan@Contoso.com"
| count
Result on the sample · 1 row
| Count |
|---|
| 16 |
With ==, the same query finds nothing, because the stored name is in lower case.
Your turn
Show the sign-ins that failed (ResultType is not "0") and came from the Netherlands (Location is "NL").
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" and Location == "NL"
| project TimeGenerated, UserPrincipalName, IPAddress, ResultType
Result on the sample · 8 rows
| TimeGenerated | UserPrincipalName | IPAddress | ResultType |
|---|---|---|---|
| 2026-06-10 08:17:05 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 08:19:44 | alex.morgan@contoso.com | 203.0.113.45 | 500121 |
| 2026-06-10 08:15:10 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 08:14:02 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 08:19:12 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 08:16:31 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 08:18:41 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 08:20:09 | alex.morgan@contoso.com | 203.0.113.45 | 500121 |
Check your own query
Write your query for the task above and check it against the real schema.
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.
Card 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.