Module 6 -V3: Create queries for Microsoft Sentinel using Kusto Query Language (KQL) | SC-200

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/72

encourage image

There's no tags or description

Looks like no tags are added yet.

73 Terms

1
New cards

What does a KQL query do? Can it change data?

Read-only. Returns results, never changes data.

2
New cards

What does the pipe ( | ) do?

Passes results to the next operator. Left side runs first, then flows right.

3
New cards

What is a tabular expression statement?

Table in, table out. The most common KQL statement.

4
New cards

What are the two common Sentinel tables used in the module?

SecurityEvent = Windows security events. SecurityAlert = alerts.

5
New cards

Is KQL case-sensitive?

Case-sensitive. Operators must be lowercase (let, where, search). Table and column names must match exactly.

6
New cards

What does the search operator do?

Finds a term across ALL tables and columns. Fast to write, slow to run. Example: search "new"

7
New cards

What does search in (Table, App*) do?

Searches only the tables listed. App* = every table starting with App. Example: search in (SecurityEvent, App*) "new"

8
New cards

What does the where operator do?

Filters rows to only the ones that match a condition. Example: | where EventID == 4624

9
New cards

What does ago() do?

Time back from now. Example: where TimeGenerated > ago(1h). Units: d, h, m, s (1h, not 1hr).

10
New cards

How do you combine multiple filters in KQL?

Use and / or on one line, OR stack several where lines (easier to read).

11
New cards

What does the in operator do?

Matches any value in a list. Example: where EventID in (4624, 4625)

12
New cards

What is EventID 4624?

Successful logon.

13
New cards

What is EventID 4625?

Failed logon.

14
New cards

What is EventID 4634?

Logoff.

15
New cards

What is EventID 4688?

New process created.

16
New cards

What is EventID 4672?

Privileged (admin-level) logon: special privileges assigned.

17
New cards

What does == (double equals) do?

Equals, case-SENSITIVE. "User" == "user" → false

18
New cards

What does =~ (equals tilde) do?

Equals, case-INSENSITIVE. "User" =~ "user" → true. Memory: ~ = "about the same"

19
New cards

What is the difference between != and !~ ?

!= not equal (case-sensitive). !~ not equal (case-insensitive).

20
New cards

What does the let statement do?

Creates a reusable variable. Ends with ; Example: let timeOffset = 1h;

21
New cards

How do you use let to store a dataset?

Stores a whole query result to reuse by name. Example: let LowActivity = SecurityEvent | summarize cnt=count() by Account | where cnt < 1000;

22
New cards

do you use a let variable inside a where time filter?

let names the value; where does the filtering. Example: let timeOffset = 1h; then where TimeGenerated > ago(timeOffset*2) and TimeGenerated < ago(timeOffset) = between 2h ago and 1h ago.

23
New cards

What does the extend operator do?

Adds a NEW calculated column. Keeps all existing columns. Example: | extend StartDir = substring(…)

24
New cards

What does order by / sort by do?

Sorts rows. asc = low to high, desc = high to low. Default = desc.

25
New cards

What does the project operator do?

Shows only the columns you pick. Can rename or add computed columns. Example: | project Computer, Account

26
New cards

What does project-away do?

Removes the listed columns. Keeps the rest. Memory: AWAY = throw away.

27
New cards

What does project-keep do?

Keeps only the listed columns. Drops the rest.

28
New cards

What does project-rename do?

Renames a column. Example: | project-rename NewName = OldName

29
New cards

What does project-reorder do?

Changes the column order.

30
New cards

What does the summarize operator do?

Groups rows and calculates totals. Example: | summarize count() by Account

31
New cards

What does count() return?

Number of rows per group.

32
New cards

What does countif() return?

Number of rows per group that meet a condition.

33
New cards

What does dcount() return?

Number of UNIQUE values (an estimate). Memory: d = distinct.

34
New cards

What do avg(), sum(), max() and min() return?

Average / total / highest / lowest per group. Each has an -if version (avgif, sumif…).

35
New cards

How do you detect a password spray pattern? (module example)

Invalid password sign-ins → dcount(AppDisplayName) by UserPrincipalName, IPAddress. One IP failing across many apps = spray.

36
New cards

What does arg_max(TimeGenerated, *) return?

Returns the MOST RECENT full row per group. Memory: max = latest.

37
New cards

What does arg_min(TimeGenerated, *) return?

Returns the EARLIEST full row per group. Memory: min = first.

38
New cards

What does make_list() do?

Puts all values in one array per group. Keeps duplicates. Memory: List = Lots.

39
New cards

What does make_set() do?

Puts unique values in one array per group. No duplicates. Memory: Set = Single copy.

40
New cards

What does the render operator do?

Turns results into a chart. Goes LAST, after summarize. Example: | render barchart

41
New cards

What chart types can render create?

areachart, barchart, columnchart, piechart, scatterchart, timechart

42
New cards

What does bin() do?

Groups time into buckets. Example: summarize count() by bin(TimeGenerated, 1m) | render timechart

43
New cards

What does the union operator do?

Stacks ROWS from 2+ tables into one result. Example: SecurityEvent | union SigninLogs

44
New cards

What is the difference between union kind=outer and kind=inner?

outer (default) = keep all columns. inner = keep only columns found in every table.

45
New cards

What does union withsource= do?

Adds a column showing which table each row came from.

46
New cards

What does SecurityEvent | union SigninLogs | summarize count() return?

SecurityEvent | union SigninLogs | summarize count() → ONE row: total of both tables.

47
New cards

What does SecurityEvent | union (SigninLogs | summarize count()) return?

SecurityEvent | union (SigninLogs | summarize count()) → all SecurityEvent rows + ONE row with the SigninLogs count.

48
New cards

What does union App* | summarize count() by Type return?

Row count per table for every table starting with App. Type = table name.

49
New cards

What does the join operator do?

Adds COLUMNS from a second table where a key matches. Example: T1 | join kind=inner (T2) on Account

50
New cards

What is the difference between union and join?

union = stacks ROWS (on top). join = adds COLUMNS (side by side on a key).

51
New cards

What is the default join kind?

innerunique: removes duplicate keys on the LEFT, then inner join. Write kind=inner to keep every match.

52
New cards

What does join kind=inner return?

Only rows that match in BOTH tables.

53
New cards

What does join kind=leftouter return?

All LEFT rows + matching right rows. No match = empty right columns. (rightouter = the reverse)

54
New cards

What does join kind=fullouter return?

All rows from BOTH tables, matched where possible.

55
New cards

What does join kind=leftanti return?

LEFT rows with NO match on the right. Memory: anti = against / missing.

56
New cards

What does join kind=leftsemi return?

LEFT rows that DO match. Only left columns returned. Memory: semi = half (left side only).

57
New cards

When do you use $left and $right in a join?

Use when key names differ. Example: on $left.UserName == $right.Account

58
New cards

What is the best practice for join performance?

Filter first. Put the SMALLER table on the left.

59
New cards

What does extract() do?

Pulls text out with regex. Format: extract(regex, group, text). Group 1 = inside first ( ), group 0 = whole match.

60
New cards

What does extract("x=([0-9.]+)", 1, "hello x=45.6|wo") return?

extract("x=([0-9.]+)", 1, "hello x=45.6|wo") → "45.6"

61
New cards

What does tolower() do?

Converts text to lowercase so case doesn't matter.

62
New cards

What does the parse operator do?

Splits text with a fixed pattern into several columns. * = skip text. Example: parse EventText with * "resourceName=" resourceName "," *

63
New cards

What is the difference between extract and parse?

extract = regex, one value. parse = fixed pattern, many columns.

64
New cards

How do you read a field inside a dynamic column?

Reads a field inside a dynamic column. Example: DeviceDetail.operatingSystem

65
New cards

What does parse_json() do?

Turns a JSON text string into an object you can read fields from.

66
New cards

What does the array index [0] mean? (e.g. AuthDetails[0])

Picks the FIRST item in a JSON array. Example: AuthDetails[0].authenticationMethod = method of the first entry.

67
New cards

What is bracket notation ["field"] used for?

Another way to read a JSON field. AuthDetails[0]["authenticationMethod"] = AuthDetails[0].authenticationMethod

68
New cards

What does the externaldata operator do?

Pulls data from outside storage (e.g. Azure Blob with a SAS token) into the query.

69
New cards

What is a KQL function (saved query)?

Save a query with a name (e.g. PrivLogins) and call it like a table. Used to build parsers.

70
New cards

What is the difference between has and contains?

has = whole word, faster. contains = any part of text, slower. Prefer has.

71
New cards

Where do you write KQL queries in Sentinel and Defender?

Microsoft Sentinel > Logs. Defender portal > Advanced hunting.

72
New cards

What does the _CL table suffix mean?

Custom log table. Example: SecurityEvent_CL

73
New cards

What do the custom column suffixes _s, _d, _b, _t mean?

_s = string, _d = number, _b = boolean, _t = datetime. Example: EventID_s