<# .SYNOPSIS Lab 08.5 — Cross-Product Telemetry Correlation KQL Pack (Defender XDR Advanced Hunting) .DESCRIPTION Outputs verified read-only KQL queries for Pre-Flight table ingestion checks and unified cross-product correlation across Entra ID (AADSignInEventsBeta), Defender for Endpoint (DeviceFileEvents), and Defender for Cloud Apps (CloudAppEvents). Classification : Read-only telemetry pack (Salt okunur KQL) Required Roles : Security Reader in security.microsoft.com .NOTES Author : Caner Cetinkaya (canercetinkaya.com/labs/08-attack-and-validate/) Safety : SAFE · SYNTHETIC (Read-only Advanced Hunting queries) #> [CmdletBinding()] param( [string]$AccountPrefix = 'lab.analyst', [string]$Lookback = '7d' ) $preFlightKql = @" // [PRE-FLIGHT] Verify all 3 upstream telemetry tables are actively ingesting union isfuzzy=true (AADSignInEventsBeta | where Timestamp > ago($Lookback) | summarize Rows=count() | extend Source="Entra_SignIn"), (DeviceFileEvents | where Timestamp > ago($Lookback) | summarize Rows=count() | extend Source="MDE_Endpoint"), (CloudAppEvents | where Timestamp > ago($Lookback) | summarize Rows=count() | extend Source="MDA_CloudApp") | project Source, Rows "@ $correlationKql = @" // [CORRELATION] Unified Identity + Endpoint + Cloud/Purview Timeline let lookback = $Lookback; let testUser = "$AccountPrefix"; union isfuzzy=true (AADSignInEventsBeta | where Timestamp > ago(lookback) | where AccountUpn startswith testUser | project Timestamp, Source="Entra_SignIn", Actor=AccountUpn, Action=Application, Detail=strcat("CA:", ConditionalAccessStatus)), (DeviceFileEvents | where Timestamp > ago(lookback) | where DeviceName startswith "win11-" | where FileName has "SYNTHETIC" or FileName has "eicar" | project Timestamp, Source="MDE_Endpoint", Actor=InitiatingProcessAccountName, Action=ActionType, Detail=FileName), (CloudAppEvents | where Timestamp > ago(lookback) | where AccountDisplayName has "Lab" or RawEventData has "SYNTHETIC" | project Timestamp, Source="MDA_CloudApp", Actor=AccountDisplayName, Action=ActionType, Detail=Application) | sort by Timestamp desc | take 50 "@ Write-Host '=== 1. PRE-FLIGHT INGESTION KQL ===' -ForegroundColor Cyan Write-Output $preFlightKql Write-Host "`n=== 2. CROSS-PRODUCT CORRELATION KQL ===" -ForegroundColor Cyan Write-Output $correlationKql