AI for M365 Admins — Chapter 9: Microsoft Security Copilot & Sentinel (AI-Assisted Threat Hunting, KQL Triage & Agent Risk)

📚 AI for Microsoft 365 Administrators Chapter 9 of 10
View Full Book TOC →
🤖 Chapter 9 · Learning Objectives AI for M365 Admins · Security Copilot & Defender XDR
What You Will Master in Chapter 9
  • Embedded vs. Standalone Security Copilot: Where M365 admins get the fastest ROI—embedded inside Defender XDR, Microsoft Entra, Purview, and Intune without switching portals.
  • SCU Capacity Planning: How Security Compute Units (SCUs) are billed, how to prevent runaway promptbook consumption, and how to configure overage limits.
  • Ready-to-Run KQL Hunting Queries: Hunt for anomalous Copilot grounding spikes, rogue local AI agent binaries, and post-outage admin phishing clicks across Defender + Sentinel.
  • Promptbooks for Tier-1/Tier-2 Triage: Chain repeatable multi-step investigation prompts to turn a 45-minute BEC investigation into a 3-minute guided summary.
CloudAppEvents | where ActionType == "CopilotInteraction" | summarize Prompts=count() by AccountDisplayName

While Chapters 1–8 focused on securing AI, Chapter 9 flips the lens: using AI to secure your Microsoft 365 tenant.

Microsoft Security Copilot connects directly into Microsoft Defender XDR, Microsoft Sentinel, Entra ID, Purview, and Intune. Instead of manually writing complex 40-line KQL joins during a live Business Email Compromise (BEC) incident or hunting for a misconfigured local AI agent, administrators can summarize incidents, reverse-engineer obfuscated PowerShell payloads, and generate validated KQL hunting queries in seconds.


Microsoft Security Copilot Embedded Architecture Across the M365 Admin Stack Defender XDR • 1-click Incident Summary • Natural Language → KQL • Script De-obfuscation Cuts MTTR by 60%+ Entra & Purview • Risky User / Sign-in Triage • DLP & Insider Risk Briefs • Agent 365 Risk Insights Identity + Data Context Microsoft Intune • Policy Conflict Analysis • Device Compliance Diffs • Error Code Remediation Faster Endpoint Triage Sentinel Data Lake • Cross-Tenant Threat Hunt • Automated Promptbooks • Rogue Local Agent Alerts Governed by SCU Caps Security Copilot respects the logged-in analyst's Entra ID RBAC permissions—it never surfaces logs the analyst cannot read.

1. High-Signal KQL Queries for AI & Agentic Threat Hunting

Run these KQL queries in Microsoft Defender XDR → Hunting → Advanced hunting (or trigger them inside a Security Copilot Promptbook):

Query 1: Detect Anomalous Copilot Prompt Spikes (Potential Automated Scraping)

KQL
CloudAppEvents
| where Timestamp > ago(24h)
| where ActionType == "CopilotInteraction"
| summarize PromptCount = count(), DistinctApps = dcount(Application) by AccountDisplayName, AccountObjectId, bin(Timestamp, 1h)
| where PromptCount > 60
| sort by PromptCount desc

Query 2: Hunt for Unsanctioned Local AI Coding Agents & Suspicious Subprocess Spawns

KQL
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("claude.exe", "codex.exe", "ollama.exe", "lmstudio.exe", "node.exe")
| where ProcessCommandLine has_any ("copilot", "claude", "openai", "anthropic", "mcp-server")
| summarize Executions = count(), Devices = dcount(DeviceName) by AccountName, FileName, InitiatingProcessFileName
| sort by Executions desc

2. Building a Repeatable BEC & Phishing Triage Promptbook

Instead of typing ad-hoc prompts during an incident, save a Security Copilot Promptbook (M365-Admin-BEC-Triage) that runs 4 chained steps automatically for any suspicious UPN:

  1. "Summarize all Entra ID sign-in failures, impossible travel alerts, and newly registered MFA methods for <UPN> in the last 72 hours."
  2. "List any new Exchange Online inbox rules (New-InboxRule), forwarding settings, or OAuth app consents granted by <UPN>."
  3. "Check whether <UPN> triggered any Purview DLP or CopilotInteraction events touching Confidential-labeled files."
  4. "Generate a 5-bullet executive incident brief and recommended PowerShell containment commands (Revoke-MgUserSignInSession)."

3. Managing Security Compute Units (SCUs) Without Bill Shock

Security Copilot is provisioned in hourly Security Compute Units (SCUs) billed to an Azure subscription:

  • Start with 1–2 provisioned SCUs for a 3–5 person SOC/M365 security team, and enable overage SCUs with a strict monthly cap so burst incident investigations don't stall while preventing runaway charges.
  • Use Role-Based Access Control (RBAC) inside Security Copilot (Settings → Role assignment) so only designated SOC analysts and M365 Security Admins can invoke SCU-consuming plugins and promptbooks.

4. Chapter 9 Lab Checklist

  • [ ] Verify Security Copilot RBAC assignments and cap overage SCUs in Azure Cost Management.
  • [ ] Run the two KQL hunting queries above in Defender XDR Advanced Hunting to baseline Copilot volume and local agent processes.
  • [ ] Create and test one repeatable Promptbook for BEC / phishing triage (see also our Post-Outage Defender KQL Hunting Runbook).

💬 Reader Comments & Feedback

Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.