Defender XDR
Build Custom Detection Rules with Auto-Response
Create custom detection rules using KQL, configure automated investigation and response, set up suppression rules, and validate detection accuracy in Microsoft Defender XDR.
Where it fits: lab 3 of 5
Investigate and respond with Defender XDR. Run incidents in the unified portal, hunt across products, build custom detections and work an attack from alert to report.
- Configure Unified Incident Management 60 min
- Advanced Cross-Product Threat Hunting 75 min
- Build Custom Detection Rules with Auto-Response 75 min
- Incident Response: Investigate a Simulated APT Attack 120 min
- OAuth Application Abuse: End-to-End SecOps Investigation 3 h
What this lab covers
In this hands-on lab you will author production-grade custom detection rules in Microsoft Defender XDR using Kusto Query Language (KQL). You will go beyond the built-in detection catalog by writing tailored queries that target suspicious PowerShell activity and lateral movement techniques. Once the queries are validated, you will promote them to scheduled custom detection rules, wire them into Automated Investigation and Response (AIR), define auto-response actions, configure suppression rules to tame false positives, and perform end-to-end validation to confirm that alerts fire and automated remediation triggers correctly.
The enterprise scenario
Contoso Ltd, a financial services organization with 5,000 endpoints, has observed a sharp increase in commodity malware that leverages encoded PowerShell commands and RMM tools for initial access, followed by lateral movement via PsExec and WMI. The SOC team needs custom detections that fire within minutes: not hours: and trigger automated containment to limit blast radius during off-hours when analyst coverage drops to a single L1 analyst. By the end of this lab you will have built exactly that pipeline: detection → alert → automated response → suppression of known-good patterns.
What you will learn
- Navigate and query the Advanced Hunting schema across DeviceEvents , DeviceProcessEvents , and DeviceNetworkEvents tables
- Write precise KQL detections for suspicious PowerShell execution patterns (encoded commands, download cradles, obfuscated scripts)
- Write KQL detections for lateral movement techniques (PsExec, WMI remote execution, SMB-based abuse)
- Promote a KQL query to a custom detection rule with proper scheduling, entity mapping, and alert enrichment
- Configure Automated Investigation and Response (AIR) automation levels and device groups
- Define auto-response actions including device isolation, file quarantine, URL blocking, and investigation package collection
- Create alert suppression rules scoped by indicator, entity, and time to reduce false positives
- Validate the full detection-response pipeline with simulated test events
Before you start
- Microsoft 365 E5 or Microsoft Defender for Endpoint Plan 2
- Microsoft Defender XDR (unified portal access)
- Microsoft 365 E5 Security add-on (if not E5 full)
- Security Administrator or Security Operator in Microsoft Entra ID
- Manage security settings permission in Defender XDR (for custom detection rule creation)
- Active remediation actions permission (for configuring automated response)
- Manage alert suppression permission (for creating suppression rules)
- A modern browser (Edge, Chrome) with access to security.microsoft.com
The 8 steps
- Understand the Advanced Hunting Schema
- Write KQL Detection for Suspicious PowerShell
- Write KQL Detection for Lateral Movement
- Create a Custom Detection Rule
- Configure Automated Investigation & Response (AIR)
- Build Auto-Response Actions
- Create Suppression Rules
- Validate Detection Accuracy