VeriKQL by Kaushik Saha

Level 0 · Your toolkit · Card 7 of 9 · by Kaushik Saha

Add columns and reuse values

Commands extend · iff · tostring · let

What these commands do

CommandWhat it doesShape
extendAdds a new column worked out from the othersT | extend New = Col1 + Col2
iffPicks one of two values: if the condition is true, the firstiff(Col == "0", "yes", "no")
tostringTurns a value into text, often from a nested fieldtostring(Col.field)
letGives a value or a whole query a name, to use belowlet Name = "value";

See them work

extend and iff label each sign-in, then summarize counts the labels:

SigninLogs
| extend Outcome = iff(ResultType == "0", "success", "failure")
| summarize SignIns = count() by Outcome
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 2 rows

OutcomeSignIns
failure25
success116

tostring turns a value into text. You'll use it most on nested fields (card 0.9):

SigninLogs
| where UserPrincipalName == "alex.morgan@contoso.com"
| extend City = tostring(LocationDetails.city)
| distinct City
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 3 rows

City
Amsterdam
Frankfurt am Main
Seattle

let names a value once, so you change it in one place:

let Attacker = "203.0.113.45";
SigninLogs
| where IPAddress == Attacker
| summarize SignIns = count(), Users = dcount(UserPrincipalName)
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 1 row

SignInsUsers
111

Your turn

Name the attacker's address 203.0.113.45 with let, then list the apps it reached, each once.

Write it in the box below and check it. Then compare with one answer; others can be right too.

Show one answer
let Attacker = "203.0.113.45";
SigninLogs
| where IPAddress == Attacker
| distinct AppDisplayName
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 3 rows

AppDisplayName
Office 365 Exchange Online
Microsoft Graph PowerShell
Azure Portal

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.