Level 0 · Your toolkit · Card 3 of 9 · by Kaushik Saha
Match text
Commands has · contains · startswith · in · in~ · has_any
What these commands do
| Command | What it does | Shape |
|---|---|---|
has | Finds a whole word inside a value. Fast, and the one to reach for first | Col has "word" |
contains | Finds any piece of text, even inside a word. Slower | Col contains "text" |
startswith | The value begins with this text | Col startswith "text" |
in | The value is one of a list | Col in ("a", "b") |
in~ | One of a list, ignoring case | Col in~ ("a", "b") |
has_any | Has at least one of these words | Col has_any ("a", "b") |
See them work
Every address in one range starts with the same text:
SigninLogs
| where IPAddress startswith "203.0.113."
| distinct IPAddress
Result on the sample · 2 rows
| IPAddress |
|---|
| 203.0.113.77 |
| 203.0.113.45 |
Two attacker addresses. has finds a whole word, and contains any piece of text:
SigninLogs
| where AppDisplayName has "PowerShell" or UserPrincipalName contains "admin"
| distinct UserPrincipalName, AppDisplayName
Result on the sample · 6 rows
| UserPrincipalName | AppDisplayName |
|---|---|
| it.admin@contoso.com | My Apps |
| it.admin@contoso.com | Azure Portal |
| it.admin@contoso.com | Office 365 Exchange Online |
| it.admin@contoso.com | Office 365 SharePoint Online |
| it.admin@contoso.com | Microsoft Graph PowerShell |
| alex.morgan@contoso.com | Microsoft Graph PowerShell |
in~ checks a list without caring about case:
SigninLogs
| where Location in~ ("nl", "de")
| summarize SignIns = count() by Location
Result on the sample · 2 rows
| Location | SignIns |
|---|---|
| DE | 12 |
| NL | 13 |
has_any finds apps by any of several words:
SigninLogs
| where AppDisplayName has_any ("SharePoint", "Storage")
| distinct AppDisplayName
Result on the sample · 2 rows
| AppDisplayName |
|---|
| Office 365 SharePoint Online |
| Azure Storage |
Your turn
Show the sign-ins that failed with a wrong password (50126) or a lock-out (50053), using in.
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 in ("50126", "50053")
| project TimeGenerated, UserPrincipalName, IPAddress, ResultType
Result on the sample · 19 rows, the first 16 shown
| TimeGenerated | UserPrincipalName | IPAddress | ResultType |
|---|---|---|---|
| 2026-06-10 07:45:44 | raj.patel@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 07:43:53 | lena.fischer@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 08:17:05 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 07:41:25 | sam.okafor@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 07:40:11 | alex.morgan@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 07:46:21 | ben.carter@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 07:40:48 | priya.nair@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 07:45:07 | sara.lind@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 07:46:58 | it.admin@contoso.com | 198.51.100.23 | 50126 |
| 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 09:47:12 | ben.carter@contoso.com | 192.0.2.20 | 50126 |
| 2026-06-10 07:42:39 | omar.haddad@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 08:19:12 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
| 2026-06-10 07:44:30 | tom.becker@contoso.com | 198.51.100.23 | 50126 |
| 2026-06-10 08:16:31 | alex.morgan@contoso.com | 203.0.113.45 | 50126 |
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.