Defender XDR and Microsoft Sentinel case walkthroughs
This walkthrough provides seven end-to-end Microsoft Defender XDR, Microsoft Sentinel and Microsoft Purview investigation and response recipes on blueboard. Each case matches a bundled playbook in playbooks/ and starter KQL queries in templates/kql/, with reproducible fixtures in templates/incidents/ so your SOC can rehearse every workflow safely in dry-run mode.
Who this is for
SOC analysts, incident commanders, approvers and AI agent engineers building or tuning Defender XDR and Sentinel response workflows.
Before you start
- Familiarity with 03 Working a Defender XDR and Sentinel incident, 05 Entity lookups, Defender hunting and Sentinel KQL and 06 Requesting, previewing and approving containment.
- Optional rehearsal: load fixtures from
templates/incidents/against your local dev/demo board (./scripts/demo.sh up) or attach the relevant playbook manually on a test incident.
Case 1: Phishing campaign and malicious attachment / URL (MDO + MDE)
- Playbook:
phishing(playbooks/phishing.md, priority 40) - KQL template:
templates/kql/phishing-bec.kql - Sample incident: built-in
seed-dev --sample
Steps
- Scope delivery and clicks (
run_hunting_queryoverEmailEvents,EmailUrlInfo,UrlClickEvents): find all recipients of the sender domain,NetworkMessageId, subject cluster, and whether any user clicked through. - Check endpoint execution: if a user opened an attachment or clicked a payload URL, query
DeviceProcessEventsandDeviceFileEventsfor the user's device and calllookup_entity(kind: "url",kind: "file"). - Check Threat Intel: call
lookup_intelon the sender IP, phishing URL/domain and attachment SHA-256 to check Sentinel TI and MSTI. - Post structured findings & IOCs: post
iocmessages (verdict: "malicious") for confirmed phishing URLs, sender IPs and attachment hashes, plus averdict(truePositive). - Propose containment (
request_action):purge_email(messages: [{ "network_message_id": "...", "recipient": "user@contoso.com" }],action: "softDelete") for every affected recipient.block_indicator(indicator_type: "url" | "domain" | "sha256",value,title,expires_in_days: 90).- If credentials were entered:
revoke_sessionsandreset_password. publish_ti_indicator(optional, once another participant has posted amaliciousiocon the incident).
- Close loop: once approvers execute containment, request
update_incident(status: "resolved",classification: "truePositive",determination: "phishing") andadd_incident_comment.
Case 2: Business Email Compromise (BEC) and AiTM token theft
- Playbook:
bec-aitm-token-theft(playbooks/bec-aitm-token-theft.md, priority 20) - KQL template:
templates/kql/identity-aitm-token-theft.kql - Sample fixture:
templates/incidents/bec-aitm-inbox-rule.json
Steps
- Correlate replayed sessions (
run_sentinel_queryonSigninLogs): group bySessionIdover 72 hours to spot tokens minted from one ASN/device and replayed from a residential proxy or attacker VPS (198.51.100.88). - Enrich the user: call
lookup_entity { "kind": "user", "value": "<upn-or-oid>" }to check directory roles, Entra ID Protection risk state, and recent risk detections. - Hunt persistence (
run_hunting_queryonCloudAppEvents+run_sentinel_queryonAuditLogsandOfficeActivity): inspectNew-InboxRule,Set-InboxRule,Set-Mailbox, new MFA method registrations (Register security info), and OAuth app consents. - Assess blast radius: check
EmailEventsfor outbound emails sent from the mailbox during the hijack window (vendor payment redirection, internal phishing) andCloudAppEventsfor SharePoint/OneDrive downloads. - Propose containment (
request_action):confirm_user_compromised(Entra OID GUID) — elevates Entra risk so Conditional Access blocks the session immediately.revoke_sessions(UPN or OID).disable_user(if the mailbox is actively sending fraud mail or passwordless/MFA persistence was added) orreset_password.block_indicatorfor the AiTM proxy IP and reverse-proxy phishing domain.
- Eradication: remove malicious inbox rules and rogue MFA methods in Exchange/Entra, then record verification in
#eradication.
Case 3: Hands-on-keyboard ransomware, LSASS dump and lateral movement
- Playbook:
ransomware-lateral-movement(playbooks/ransomware-lateral-movement.md, priority 10) - KQL template:
templates/kql/endpoint-powershell-ransomware.kql - Sample data: Trigger via live Defender incident sync or
./scripts/demo.sh up(templates/incidents/shipsbec-aitm-inbox-rule.json,oauth-app-consent.json,azure-keyvault-privesc.jsonandpurview-dlp-insider-exfil.json)
Steps
- Verify host criticality first: call
lookup_entity { "kind": "device", "value": "<machine-id-or-hostname>" }to inspecttags,is_domain_adminlogon users, exposure level and existing isolation status. Never isolate a domain controller or hypervisor (policyprotected_devicesblocks them, and isolating an unlisted tier-0 server can cause an outage). - Scope process tree and credential access (
run_hunting_query): queryDeviceProcessEvents,DeviceNetworkEventsandDeviceLogonEventsforlsass.exeaccess,vssadmin delete shadows,wbadmin, encoded PowerShell, SMB/WinRM/RDP fan-out, and newly created services or scheduled tasks. - Preserve volatile forensics and contain fast:
collect_investigation_package(typically auto-approved when target is in evidence).isolate_device(isolation_type: "Selective"or"Full") for every confirmed compromised workstation/member server.stop_and_quarantine_file(SHA-1) for active payload binaries still running on unaffected or partially affected hosts.restrict_app_executionfor hosts suspected of staging where full network isolation would disrupt production.tag_device(tag: "IR-Contained",action: "Add") to track containment across Defender.
- Contain compromised accounts: for any account whose credentials were present on the LSASS-dumped host, propose
revoke_sessionsanddisable_user(orreset_password). - Block C2 and payload hashes: propose
block_indicator(indicator_type: "sha256" | "ip" | "domain",value,title) —CatalogsubmitsBlockAndRemediateautomatically for file hashes andBlockfor network indicators. - Recovery: after re-imaging or verified eradication and
run_av_scan(Full), proposerelease_deviceandunrestrict_app_executionvia human approval.
Case 4: Illicit OAuth app consent and service principal abuse
- Playbook:
oauth-app-consent-abuse(playbooks/oauth-app-consent-abuse.md, priority 15) - KQL template:
templates/kql/oauth-app-consent-abuse.kql - Sample fixture:
templates/incidents/oauth-app-consent.json
Steps
- Inspect the application: call
lookup_entity { "kind": "oauth_app", "value": "<appId-or-sp-objectId>" }to seeverifiedPublisher,accountEnabled, reply URLs, delegatedoauth_grants(e.g.Mail.Read,Files.ReadWrite.All,offline_access) andapp_role_assignments. - Audit who consented and what was accessed (
run_sentinel_query):- Query
AuditLogsfor"Consent to application"and"Add OAuth2PermissionGrant". - Query
AADServicePrincipalSignInLogsandOfficeActivity(MailItemsAccessed/AppId) to measure data exfiltration.
- Query
- Propose containment (
request_action):disable_service_principal(service_principal_id: Entra service principal object ID GUID) — immediately stops token issuance for the malicious enterprise app.revoke_sessionsfor the consenting user(s).block_indicatorfor the app's reply URL domain / callback IP if attacker-hosted.
- Eradicate: revoke the OAuth2 permission grants in Entra ID and delete the enterprise application once forensics are complete.
Case 5: Password spray and MFA fatigue
- Playbook:
password-spray-mfa-fatigue(playbooks/password-spray-mfa-fatigue.md, priority 35) - KQL template:
templates/kql/identity-aitm-token-theft.kql
Steps
- Separate failed noise from accepted logins (
run_sentinel_queryonSigninLogs): count distinct targeted accounts per source IP / user agent, then filter forResultType == 0orMfaDetailapprovals after repeated500121/50074denials. - Check affected users: call
lookup_entity { "kind": "user", "value": "<upn>" }for every user who succeeded or accepted an MFA prompt. - Propose targeted containment:
- For confirmed compromised accounts:
confirm_user_compromised,revoke_sessions,reset_password. - For attacker infrastructure (excluding shared corporate/VPN NATs):
block_indicator(indicator_type: "ip"). - Do not disable unaffected spray targets; post a
findingsummarising clean targets so approvers see the exact boundary.
- For confirmed compromised accounts:
Case 6: Azure / Defender for Cloud privilege escalation and Key Vault enumeration
- Playbook:
azure-privilege-escalation(playbooks/azure-privilege-escalation.md, priority 25) - KQL template:
templates/kql/cloud-azure-privesc.kql - Sample fixture:
templates/incidents/azure-keyvault-privesc.json
Steps
- Pivot on caller identity (
run_sentinel_queryonAzureActivity,AzureDiagnosticsforKeyVault, andAuditLogs): list role assignments (Microsoft.Authorization/roleAssignments/write), Key Vault secret/keySecretGet/SecretListcalls, and new federated credentials or secrets added to app registrations. - Inspect caller: call
lookup_entity(kind: "user"orkind: "service_principal") to verify whether the identity holds Owner, User Access Administrator, Privileged Role Administrator or high-impact Graph permissions. - Check correlation with Defender for Endpoint: if the caller is a human admin, check
SigninLogsandDeviceLogonEventsto determine whether their workstation or token was stolen. - Propose containment:
- If a workload identity / service principal was abused:
disable_service_principal. - If a human identity was abused (and not in
protected_users):confirm_user_compromised,revoke_sessions,disable_user. - If a compromised admin workstation is implicated:
isolate_deviceandcollect_investigation_package.
- If a workload identity / service principal was abused:
- Escalate break-glass or protected accounts: if policy rejects containment because the caller is in
protected_users, post a high-priorityquestion@mentioning an on-call human lead so they execute out-of-band break-glass rotation.
Case 7: Microsoft Purview DLP & Insider Risk data exfiltration
- Playbook:
data-exfiltration-cloud(playbooks/data-exfiltration-cloud.md, priority 30) - KQL template:
templates/kql/purview-dlp-insider-ai.kql - Sample fixture:
templates/incidents/purview-dlp-insider-exfil.json
Follow 12 Sentinel MCP, Microsoft Purview and Defender Unified SOC to inspect Purview DLP and Insider Risk alerts (lookup_purview_context), correlate CloudAppEvents, OfficeActivity and Defender blobEvidence/teamsMessageEvidence, and propose revoke_sessions, disable_user or disable_service_principal through human approval.
What blueboard checks
- Incident-scoped actions (
update_incident,add_incident_comment) must passincident_id; entity-targeted actions should passincidentonrequest_actionsoPolicyEngineverifies targets appear in the linked incident's alerts/evidence. - Protected users (break-glass, Global Admins), protected devices (DCs, hypervisors, PKI), protected apps (
protected_apps) and protected indicators (corporate domains, Microsoft endpoints) are always rejected outright. - Every KQL query executed during these cases is audited under
enrich.huntorenrich.sentinel_hunt.
What is recorded in audit_log
incident.synced/playbook.attachedenrich.lookup,enrich.purview,enrich.hunt,enrich.sentinel_huntaction.requested,action.approved_once,action.approved,action.succeeded(oraction.dry_run)
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
confirm_user_compromised or disable_service_principal rejects UPN or display name | Graph Identity Protection and Service Principal endpoints require the Entra object ID GUID | Call lookup_entity first to read the exact id GUID and pass that GUID in params. |
| Policy flags "target not in incident evidence" on a lateral-movement host | The secondary host was discovered via KQL, not yet linked as an alert in Defender | Either link/sync the updated Defender incident (sync_incident) or proceed with explicit human approval and cite the KQL finding in justification. |
| Playbook did not auto-attach | A higher-priority playbook matched first, or alert title/categories differed | Call attach_playbook (POST /api/incidents/{id}/playbook) on an incident that does not yet have a playbook attached. |
Related guides
- 04 Response playbooks and progressive checklists, for playbook priority and custom authoring.
- 05 Entity lookups, Defender hunting and Sentinel KQL, for query syntax and rate limits.
- 06 Requesting, previewing and approving containment, for the full 26-action catalogue and approval rules.
- 12 Sentinel MCP, Microsoft Purview and Defender Unified SOC, for Purview DLP/IRM, Sentinel MCP and Defender XDR ISOC walkthroughs.