Shadow AI Governance in Microsoft 365 — Detection, Blocking, and Network-Level Controls

A complete field guide to detecting, blocking, and governing unauthorized AI tools in your Microsoft 365 environment — covering Defender for Cloud Apps, Entra Internet Access, Conditional Access, Purview DLP, and KQL threat hunting.

Shadow AI Governance in Microsoft 365 — Detection, Blocking, and Network-Level Controls
DEFENDER · ENTRA · PURVIEW · Modern Endpoint Guides
🕵️ Shadow AI Governance

Shadow AI Governance in Microsoft 365

Employees are using ChatGPT, Claude, Perplexity, and dozens of other AI tools — with or without your permission. This guide covers the complete playbook: detect every AI app in use, block unsanctioned ones at three independent layers, enforce DLP policies on AI traffic, and build the governance model that keeps enforcement operational as the AI landscape changes weekly.

Defender for Cloud Apps Entra Internet Access Conditional Access Purview DLP Sentinel KQL M365 E5

📋 What is Shadow AI

Shadow AI refers to AI-powered tools and services used within an organization without IT's knowledge, approval, or security review. Unlike traditional Shadow IT — where the risk was primarily data storage or collaboration tools — Shadow AI introduces a qualitatively different threat: employees are actively feeding sensitive business data into models they do not control, hosted on infrastructure they cannot audit.

⚠️
Why Shadow AI is different from classic Shadow IT Traditional Shadow IT stored data externally. Shadow AI processes and learns from that data. Prompts containing customer PII, deal terms, source code, or health data may persist in third-party training pipelines — permanently, across model versions.

Common Shadow AI App Categories

💬

Generative Chat

ChatGPT, Claude.ai, Gemini, Copilot (personal), Perplexity, Phind, You.com

🖼️

Image & Media Gen

Midjourney, DALL-E (external), Stable Diffusion, Adobe Firefly, Runway ML

💻

AI Code Assistants

GitHub Copilot (personal), Cursor, Codeium, Tabnine (external), Replit AI

📊

AI Productivity

Notion AI, Jasper, Copy.ai, Otter.ai, Fireflies.ai (meeting transcription)

🔎

AI Search

Perplexity Pro, Bing Copilot (personal), You.com, Kagi AI

🧪

Developer / API

Direct OpenAI API, Anthropic API, Hugging Face, Replicate — called from internal scripts

ℹ️
License requirement Full Shadow AI governance requires Microsoft 365 E5 or Microsoft Defender for Cloud Apps + Entra ID P2 + Microsoft Entra Internet Access. A subset of controls (basic Conditional Access) is available with E3 + Entra P1.

⚠️ Risk Landscape

Not all Shadow AI usage carries the same risk. Your enforcement strategy should be tiered — block highest-risk scenarios entirely, monitor medium-risk with DLP, allow low-risk with logging.

Risk Tiers by Data Sensitivity

🔴 Critical Risk
Customer PII, health records (HIPAA), financial data, source code, M&A documents pasted into public AI
🟡 High Risk
Internal strategy docs, unreleased product plans, HR data, legal correspondence
🟠 Medium Risk
Internal meeting summaries, general business communications, non-classified project docs
🟢 Low Risk
Public knowledge queries, generic writing assistance with no sensitive data

Top Shadow AI Regulatory Risks

RegulationShadow AI RiskControl Required
GDPR / Israeli Privacy LawPII sent to US-based AI providers without Data Processing AgreementsBlock + DLP policy on personal data categories
HIPAAPHI included in AI prompts processed by non-BAA providersBlock all public AI + enforce Microsoft Copilot only
PCI-DSSCardholder data pasted into chat promptsPurview sensitive info type + DLP block action
ISO 27001 A.8.12Data leakage via unsanctioned cloud applicationsMDCA Cloud Discovery + session controls
SOC 2 CC6.6Unauthorized transmission of confidential informationCASB + conditional access + audit logging

🔍 Discovery with Microsoft Defender for Cloud Apps

Before you can block, you need to know what's in use. Defender for Cloud Apps (MDCA) Cloud Discovery ingests traffic logs from your network appliances and MDE-enrolled endpoints, then scores every app against 90+ risk factors.

Step 1 — Enable Cloud Discovery

security.microsoft.com › Cloud Apps › Cloud Discovery
☁️ Cloud Apps
🔍 Cloud Discovery
📋 App catalog
🔒 Policies
📊 Activity log
⚙️ Settings
Cloud Apps › Cloud Discovery
Cloud Discovery Dashboard
App NameCategoryRisk ScoreUsersTransactionsStatus
ChatGPT (OpenAI)Generative AI6.8/10472,341Unsanctioned
Claude.aiGenerative AI7.2/1023987Unsanctioned
PerplexityAI Search6.4/1019654Blocked
Otter.aiMeeting AI5.1/108112Unsanctioned
Microsoft CopilotGenerative AI9.8/1021418,443Sanctioned
ℹ️ Risk score incorporates: data retention policy, encryption in transit, GDPR compliance, SOC 2 certification, data sovereignty, AI training data usage
📸 Cloud Discovery dashboard — all AI apps in use, with risk scores and user counts. Mark known-good apps Sanctioned; everything else is a candidate for review or block.

Step 2 — Connect MDE as Log Source (Agentless)

If you already have Microsoft Defender for Endpoint deployed, you get Cloud Discovery data for free — no network log upload needed. MDE reports all app traffic per endpoint directly to MDCA.

1

Enable MDE Integration

security.microsoft.com → Settings → Cloud Apps → Microsoft Defender for Endpoint → toggle ON "Enforce app access with Microsoft Defender for Endpoint"

2

Enable Network Protection on Endpoints

Intune → Endpoint security → Attack Surface Reduction → Enable Network Protection (Block mode). This is what enforces MDCA block decisions on-device.

3

Verify Discovery Traffic

Cloud Discovery → Win10/11 Discovery tab → confirm endpoint traffic is appearing within 15 minutes of policy application.

Step 3 — Tag Apps and Set Enforcement

In the MDCA App catalog, filter by category "Generative AI" and "AI Assistant". For each app:

✅ Sanctioned

Reviewed, approved, and GDPR-compliant. Microsoft Copilot, Azure OpenAI Service (org tenant). Applying this tag pushes an "allow" signal to MDE Network Protection.

🚫 Unsanctioned

Unapproved or pending review. Applying this tag — combined with MDE integration — automatically blocks access on all MDE-enrolled Windows devices within 2 hours.

⚠️
MDE block has a 2–4 hour propagation delay After tagging an app Unsanctioned, MDE policy refresh cycles are 2–4 hours. For immediate blocking, supplement with a Conditional Access policy that fires in real-time.

Create an Anomaly Detection Policy for AI Data Exfiltration

1

MDCA → Policies → Policy Management → Create Policy → Activity Policy

Filter: App = (any Unsanctioned AI app). Activity = File upload / Form submit. Severity = High.

2

Set Governance Action

Action: Block activity + Send alert. Optionally: Notify user with custom message explaining the corporate AI policy.

3

Enable Session Control for Sanctioned-but-Monitored Apps

For apps in a "monitored" tier, use MDCA Session Policies with action = Monitor (not block) to log every file upload and prompt while allowing access.

🌐 Microsoft Entra Internet Access (Global Secure Access)

Entra Internet Access (part of Global Secure Access) is Microsoft's Security Service Edge (SSE) solution. It routes all internet-bound traffic through Microsoft's cloud network, enabling you to apply identity-aware web filtering — blocking AI sites based on category, FQDN, or app risk — regardless of where the user is located.

ℹ️
Entra Internet Access vs. traditional web proxy Unlike a hardware proxy, Entra Internet Access is identity-aware. You can allow ChatGPT for the AI Research team and block it for everyone else — enforced at the user/group level, not the network segment level. No VPN required; works natively for remote and hybrid users.

Enable Entra Internet Access

1

Enable Global Secure Access in Entra Admin Center

entra.microsoft.com → Global Secure Access → Overview → Enable. This provisions the GSA tenant-level infrastructure.

2

Deploy the Global Secure Access Client

Deploy via Intune: Apps → Windows apps → Add → Global Secure Access Client. Or use the MSI: gsaclient.exe /quiet. The client establishes a per-app tunnel to Microsoft's SSE network.

3

Create a Web Content Filtering Policy

Global Secure Access → Internet Access → Web content filtering policies → Create. Add category "Generative AI Tools" (built-in category in Entra Internet Access) to the Block list.

4

Link to a Security Profile

Create a Security Profile → assign the web content filtering policy → assign the Security Profile to target groups in Conditional Access.

Configure Custom AI FQDN Block List

The built-in category covers major AI sites. Supplement with a custom FQDN list for AI tools that appear after the category was last updated:

Custom FQDN Block List — Entra Internet Access # Generative AI — chat interfaces chat.openai.com chatgpt.com claude.ai gemini.google.com bard.google.com perplexity.ai you.com phind.com poe.com character.ai pi.ai inflection.ai # AI Image / Video generation midjourney.com discord.com/channels (if Midjourney bot usage is a concern) runwayml.com stability.ai dreamstudio.ai kaiber.ai # AI Code Assistants (external) cursor.sh codeium.com replit.com/ai # AI Meeting / Transcription otter.ai fireflies.ai fathom.video avoma.com # AI APIs (direct usage from scripts) api.openai.com api.anthropic.com generativelanguage.googleapis.com api.perplexity.ai

Entra Internet Access Security Profile

entra.microsoft.com › Global Secure Access › Internet Access › Security profiles
🌐 Global Secure Access
🔒 Microsoft 365 Access
🛡️ Internet Access
📊 Traffic logs
Global Secure Access › Internet Access › Security profiles
Security Profile: Block-Shadow-AI
PolicyTypeActionPriority
Generative AI Category BlockWeb content filterBlock100
Custom AI FQDN ListFQDN filterBlock200
Microsoft Copilot AllowlistFQDN filterAllow50
Default InternetBaselineAllow65000
ℹ️ Lower priority number = evaluated first. Allow rules for sanctioned Microsoft AI services must have lower numbers than the block rules.
📸 Security Profile with tiered rules: Microsoft Copilot allowed first (priority 50), then block all other AI (100/200), then default allow for everything else.

Assign Security Profile via Conditional Access

Conditional Access Policy — Link GSA Security Profile Policy name: GSA-Block-ShadowAI-AllUsers Users: All Users Exclude: AI-Research-SG (security group for exempted users) Cloud apps: All internet resources (Global Secure Access) Conditions: Any location, Any device Session: Use Global Secure Access security profile → Block-Shadow-AI Grant: Require compliant device

🔐 Conditional Access for AI Applications

Conditional Access controls access at the authentication layer. When a user tries to sign into a registered AI service (like the Microsoft-published ChatGPT Enterprise app, or a custom OAuth app), CA fires before the session begins — independent of network controls.

Policy 1 — Block Access to All External Generative AI Apps

CA Policy: Block-Generative-AI-External-Apps Name: CA-BLOCK-External-AI-Apps Users: All Users Exclude: grp-AI-Approved-Users, Break-Glass accounts Cloud apps: - ChatGPT Enterprise (App ID if registered in your tenant) - Custom OAuth apps tagged "AI-Unsanctioned" in App Governance - Any third-party app with "AI" or "LLM" in the app name Conditions: - Platforms: Any - Locations: Any (include trusted + untrusted) Grant: BLOCK ACCESS Mode: On (Report-only first for 2 weeks)
⚠️
CA alone is not sufficient for web-based AI Conditional Access only fires when an OAuth/SAML login is triggered. Browser-based AI tools accessed without SSO (e.g., a user manually signing into ChatGPT with their personal email) bypass CA entirely. You need MDCA + Entra Internet Access for full coverage.

Policy 2 — Session Control on Monitored AI Apps

For AI tools that are conditionally approved (e.g., ChatGPT Enterprise with a corporate account), enforce MDCA session proxy to inspect every interaction:

CA Policy: Monitor-Approved-AI-Session Name: CA-SESSION-Approved-AI-Apps Users: grp-AI-Approved-Users Cloud apps: ChatGPT Enterprise, Copilot (Work) Conditions: - Platforms: Any Grant: Require MFA + Require compliant device Session: - Use Conditional Access App Control (MCAS proxy) - Sign-in frequency: Every 8 hours (re-auth forces re-evaluation) - Disable browser persistence (no "Keep me signed in")

Policy 3 — Require Managed Device for All AI Access

CA Policy: Require-Compliant-Device-AI Name: CA-AI-ManagedDevice-Required Users: All Users Cloud apps: [All sanctioned AI apps] Grant: - Require device to be marked as compliant (Intune) - OR: Require Hybrid Azure AD joined device - Operator: Require ONE of the selected controls Block: If neither condition is met

App Governance — OAuth App Oversight

Users frequently grant OAuth permissions to AI apps from their personal Microsoft accounts. App Governance (built into MDCA) gives you visibility and control over every OAuth app that has been granted permissions in your tenant.

1

Enable App Governance

security.microsoft.com → Cloud Apps → App governance → Enable. App governance adds a dedicated dashboard showing all OAuth apps, their permissions, and anomaly alerts.

2

Create an App Policy for AI-Permission Apps

App governance → Policies → Create → "AI app high-privilege detection". Trigger: App with keyword "AI" or "GPT" in app name requests Mail.Read or Files.ReadWrite permission. Action: Generate alert + disable app.

3

Review Existing Grants

App governance → Apps → filter by "AI" → review all apps with Delegated permissions to Microsoft Graph scopes. Revoke any that are not approved.

🛡️ Network-Level Controls

Network controls are your deepest enforcement layer — they apply even to unmanaged devices on your corporate Wi-Fi, and to API calls made by scripts and tools that don't trigger browser-level controls. This is the layer that catches developer direct API usage.

Layer 1 — DNS Filtering (Fastest, Broadest Coverage)

DNS-based blocking prevents name resolution for AI domains. Applies to all devices on-network. Works as a fallback even if other controls fail.

Windows DNS RPZ (Response Policy Zone) — AI Block List ; Add to your DNS server RPZ zone file chat.openai.com IN CNAME . ; NXDOMAIN api.openai.com IN CNAME . claude.ai IN CNAME . api.anthropic.com IN CNAME . gemini.google.com IN CNAME . perplexity.ai IN CNAME . you.com IN CNAME . cursor.sh IN CNAME . otter.ai IN CNAME . fireflies.ai IN CNAME . midjourney.com IN CNAME . runwayml.com IN CNAME .
ℹ️
Microsoft DNS for Cloud-Based DNS Filtering If using Microsoft Defender for Endpoint with DNS Protection enabled, use the custom indicator list instead of RPZ. Go to security.microsoft.com → Settings → Endpoints → Indicators → URLs/Domains → Add indicator → Block + Warn. This works for remote users too.

Layer 2 — Firewall FQDN Filtering with TLS Inspection

FQDN-based firewall rules block traffic even if DNS is bypassed (direct IP). TLS inspection is required to distinguish between allowed and blocked paths on CDNs (e.g., api.openai.com vs. openai.com/about).

Azure Firewall — AI Block Application Rule Collection # Azure Firewall Policy — Application Rule Collection Name: Block-Shadow-AI Priority: 200 Action: Deny Rules: - Name: Block-OpenAI-API Source: Corp-Network-Subnet Protocols: HTTPS:443 Target FQDNs: api.openai.com chat.openai.com chatgpt.com *.openai.com - Name: Block-Anthropic Source: Corp-Network-Subnet Protocols: HTTPS:443 Target FQDNs: api.anthropic.com claude.ai *.anthropic.com - Name: Block-AI-Tools Source: Corp-Network-Subnet Protocols: HTTPS:443 Target FQDNs: perplexity.ai you.com cursor.sh otter.ai fireflies.ai midjourney.com # --- Allowlist (higher priority = lower number) --- Name: Allow-Microsoft-AI Priority: 100 Action: Allow Rules: - Name: Allow-Copilot-M365 Target FQDNs: copilot.microsoft.com *.copilot.microsoft.com sydney.bing.com # Copilot backend, needed for M365 Copilot *.oai.azure.com # Azure OpenAI Service (corporate tenant)

Layer 3 — MDE Custom Indicators (Remote Users)

For remote users who bypass corporate network, MDE Network Protection enforces FQDN blocks directly on the endpoint — no VPN or proxy required.

1

security.microsoft.com → Settings → Endpoints → Indicators

Create URL/Domain indicators for each AI domain. Action: Block and warn (shows a customizable block page). Severity: High. Category: Unauthorized application.

2

Set Network Protection to Block Mode

Intune → Endpoint Security → Attack Surface Reduction → Network protection: Block. Without Block mode, indicators show alerts but don't enforce.

3

Customize the Block Message

Settings → Endpoints → Web content filtering → Customize block notification. Include: why it's blocked, what the approved alternative is (Microsoft Copilot), and the IT exception request link.

TLS Inspection Considerations

⚠️ Inspect for Monitoring

TLS inspection on monitored AI traffic lets MDCA see prompt content and file uploads. Required for DLP policy enforcement on AI sessions. Needs a trusted enterprise CA deployed via Intune.

🚫 Exempt from Inspection

Never inspect: banking, healthcare portals, identity providers (Entra, ADFS), certificate management endpoints. Breaking TLS on these causes auth failures and compliance issues.

📱 Intune App Protection & Device Compliance

Intune controls the device-side of Shadow AI. App Protection Policies (APP) block data from being pasted into unapproved apps. Compliance policies ensure only healthy devices can access corporate resources — including approved AI tools.

App Protection Policy — Block Copy/Paste to AI Apps

The most common Shadow AI data exfiltration vector: a user copies a confidential document paragraph, then pastes it into ChatGPT. APP blocks this clipboard transfer at the OS level.

intune.microsoft.com › Apps › App protection policies
📱 Apps
🛡️ App protection
📋 App configuration
🔒 Compliance
Apps › App protection policies
APP: Block-Data-to-Unmanaged-Apps (Windows MAM)
SettingValue
Cut and copy between appsBlocked
Paste into managed appsAllowed
Send org data to other appsPolicy managed apps only
Receive data from other appsAll apps
Save copies of org dataBlock
Web content transfer to any browserMicrosoft Edge only
ℹ️ "Policy managed apps" = apps with an Intune APP assigned. Microsoft Edge, Teams, Word, Excel, Outlook are policy managed. A browser tab to ChatGPT is not.
📸 Intune App Protection Policy — clipboard operations are blocked between managed M365 apps and unmanaged browsers/apps (which includes AI tools).

Device Compliance Policy — AI Access Gate

Only compliant devices should be able to access even the approved AI tools. This ensures that if a user's device is compromised, AI access is revoked alongside other corporate resource access.

Intune Compliance Policy — Windows 11 AI Access Policy: Comply-Win11-AI-Access Platform: Windows 10/11 Requirements: - OS version minimum: 10.0.22621 (Windows 11 22H2) - BitLocker: Required - Secure Boot: Required - Antivirus: Required (Defender) - Real-time protection: Required - Firewall: Required - Defender for Endpoint risk level: Medium or lower Non-compliance action: - Mark device noncompliant: immediately - Send email to user: after 1 day - Retire device: after 90 days (optional, confirm with policy)

Windows Information Protection (WIP) — Legacy Fallback

⚠️
WIP is deprecated — use APP (MAM) instead Windows Information Protection is deprecated as of Windows 11 24H2. Microsoft recommends migrating to Intune MAM (App Protection Policies) for Windows for the same clipboard and data transfer controls without the WIP limitations.

Managed Browser Policy — Force Edge for AI Traffic

Require that all AI-related web browsing happens through Microsoft Edge (which supports Intune MAM policies), not Chrome or Firefox (which do not):

1

App Configuration Policy → Microsoft Edge for Windows

Setting: "Redirect protected app links to Microsoft Edge" = Enabled. This ensures that links opened from managed apps (Outlook, Teams) open in Edge under MAM policy.

2

Block Chrome/Firefox Installation via AppLocker or WDAC

For high-security environments: block installation of non-Edge browsers via Windows Defender Application Control (WDAC) policy deployed through Intune → Endpoint Security → Application Control.

🏛️ Microsoft Purview — DLP for AI Traffic

Purview DLP adds a content-aware layer: even if a user reaches an AI site (because it's in the "monitored" tier), Purview can detect when they're attempting to upload or paste sensitive data and block that specific action — not the entire session.

DLP Policy — Block Sensitive Data Upload to AI Sites

1

Purview Compliance Portal → Data loss prevention → Policies → Create

Location: Endpoint devices (for on-device DLP). Select: All devices.

2

Define Sensitive Info Types

Add: Credit Card Number, Israel Identity Number, Health Records (HIPAA), Source Code (any language), EU Social Security Number, Bank Account Numbers. Use confidence: High only (reduce false positives).

3

Define the Condition: Upload to AI Sites

Activity: Upload to browser. Service domain restriction: Match against your AI FQDN list. Paste to browser: Match against AI FQDN list. This is the critical setting — it triggers only on uploads to AI domains, not general web.

4

Action: Block with Override

Primary action: Block. Override behavior: Allow with business justification. This gives users who have a legitimate reason the ability to proceed after typing a justification — which is logged.

compliance.microsoft.com › Data loss prevention › Policies
🏛️ Data loss prevention
📋 Policies
📊 DLP alerts
📈 Reports
⚙️ Endpoint DLP settings
DLP › Block-SensitiveData-to-AI
Policy: Block-SensitiveData-to-AI-Sites
RuleSensitive InfoActionStatus
PII to AI SitesCredit card, ID, Health recordsBlockOn
Source Code to AISource code (custom classifier)Block + OverrideOn
Financial Data to AIBank accounts, SWIFT codesBlockOn
Low-sensitivity catch-allConfidential labelWarn + LogOn
ℹ️ Endpoint DLP requires Microsoft Purview Information Protection client + Defender for Endpoint running on devices. Supported on Windows 10/11 and macOS.
📸 Purview DLP policy targeting AI sites — granular per-rule actions allow different responses for PII (hard block) vs. source code (block with override + justification).

Sensitivity Label Integration

If your organization uses Purview sensitivity labels, any labeled content pasted into an AI tool triggers DLP based on the label — even if the raw text doesn't match a sensitive info type pattern:

DLP Rule — Block Labeled Content Upload to AI Rule: Block-Labeled-Content-to-AI Condition: - Content contains sensitivity label: Confidential, Highly Confidential - User activity: Upload to restricted service domain (AI sites list) - OR: Paste to browser (AI sites list) Action: - Block the activity - Send policy tip: "Confidential content cannot be shared with external AI services. Use Microsoft Copilot (your M365 subscription includes it)." User notification: Show policy tip in notification area Incident report: Send to DLP-Alerts@contoso.com

Adaptive Protection — Risk-Based DLP

Purview Adaptive Protection integrates with Insider Risk Management to automatically tighten DLP enforcement for users with elevated risk scores (e.g., users who recently resigned, failed phishing sims, or triggered multiple alerts):

1

Enable Adaptive Protection

Purview → Insider risk management → Adaptive protection → Enable. This links IRM risk levels to DLP enforcement dynamically.

2

Add an Adaptive Protection Condition to AI DLP Rules

In your DLP policy rule, add condition: "User is at risk" = Elevated risk level. Action: Block (even for content that would normally only warn). This automatically increases enforcement for high-risk users.

🎯 KQL Threat Hunting — Shadow AI Detection

The following queries run in Microsoft Defender XDR Advanced Hunting and Microsoft Sentinel. Use them to detect Shadow AI usage that bypassed controls, or to build detection rules.

Query 1 — AI Domain Access from Endpoints (MDE)

KQL — Defender XDR: AI Domain DNS Queries DeviceNetworkEvents | where Timestamp > ago(7d) | where RemoteUrl has_any ( "chat.openai.com", "api.openai.com", "chatgpt.com", "claude.ai", "api.anthropic.com", "gemini.google.com", "bard.google.com", "perplexity.ai", "you.com", "phind.com", "cursor.sh", "codeium.com", "otter.ai", "fireflies.ai", "midjourney.com", "runwayml.com" ) | summarize TotalConnections = count(), UniqueAIDomains = dcount(RemoteUrl), LastSeen = max(Timestamp) by DeviceName, InitiatingProcessAccountName, RemoteUrl | sort by TotalConnections desc | project-reorder DeviceName, InitiatingProcessAccountName, RemoteUrl, TotalConnections, LastSeen

Query 2 — Large Data Uploads to AI APIs (Potential Exfiltration)

KQL — Defender XDR: High-Volume AI API Uploads DeviceNetworkEvents | where Timestamp > ago(24h) | where RemoteUrl has_any ("api.openai.com", "api.anthropic.com", "generativelanguage.googleapis.com") | where SentBytes > 50000 // Uploads > 50KB = likely document paste or file upload | project Timestamp, DeviceName, AccountName = InitiatingProcessAccountName, Process = InitiatingProcessFileName, RemoteUrl, SentBytes = SentBytes / 1024, // Convert to KB ReceivedBytes = ReceivedBytes / 1024 | order by SentBytes desc

Query 3 — OAuth App Consent to AI Apps (Entra)

KQL — Sentinel/Defender XDR: AI App OAuth Consent AuditLogs | where TimeGenerated > ago(30d) | where OperationName == "Consent to application" | extend AppName = tostring(TargetResources[0].displayName) | extend ConsentedBy = tostring(InitiatedBy.user.userPrincipalName) | extend Permissions = tostring(AdditionalDetails) | where AppName has_any ("GPT", "AI", "LLM", "Copilot", "Claude", "Gemini", "Assistant", "ChatBot") | project TimeGenerated, AppName, ConsentedBy, Permissions | order by TimeGenerated desc

Query 4 — Sensitive File Access Before AI Domain Visit

KQL — Correlated: Sensitive File → AI Site (30-minute window) // Step 1: Get sensitive file access events let SensitiveAccess = DeviceFileEvents | where Timestamp > ago(7d) | where FileName has_any (".docx", ".xlsx", ".pdf", ".pptx") | where FolderPath has_any ("Confidential", "Secret", "HR", "Finance", "Legal", "M&A") | project DeviceName, AccountName = InitiatingProcessAccountName, FileTime = Timestamp, FileName, FolderPath; // Step 2: Get AI domain visits within 30 min after file access let AIAccess = DeviceNetworkEvents | where Timestamp > ago(7d) | where RemoteUrl has_any ("chat.openai.com", "claude.ai", "perplexity.ai", "you.com", "gemini.google.com") | project DeviceName, AccountName = InitiatingProcessAccountName, AITime = Timestamp, AIDomain = RemoteUrl; // Step 3: Correlate — AI visit within 30 minutes of sensitive file read SensitiveAccess | join kind=inner AIAccess on DeviceName, AccountName | where AITime > FileTime and AITime < FileTime + 30m | project DeviceName, AccountName, FileTime, FileName, FolderPath, AITime, AIDomain | order by FileTime desc

Query 5 — MDCA Alerts for Shadow AI

KQL — Sentinel: MDCA Shadow AI Alerts CloudAppEvents | where TimeGenerated > ago(7d) | where AppCategory has_any ("Generative AI", "AI Assistant", "AI Search") | where ActionType in ("FileUpload", "FormSubmit", "PageView") | summarize Events = count(), UniqueApps = dcount(Application), LastActivity = max(TimeGenerated) by AccountDisplayName, AccountObjectId, Application, ActionType | where Events > 5 | order by Events desc

Sentinel Analytics Rule — Shadow AI Exfiltration Alert

1

Sentinel → Analytics → Create scheduled query rule

Name: "Shadow AI — Sensitive Data Upload Detected". Paste Query 4 (correlated file + AI visit). Frequency: Every 1 hour. Lookback: 30 minutes.

2

Set Alert Threshold and Severity

Generate alert when result count is greater than 0. Severity: High. MITRE tactic: Exfiltration (TA0010). Technique: Exfiltration Over Web Service (T1567).

3

Map Entity Identifiers

Account entity: AccountName. Host entity: DeviceName. URL entity: AIDomain. This enables automatic enrichment in Sentinel incidents and correlates with other alerts on the same user.

🏢 Governance Framework

Technology controls only work if there's an operational model behind them. Shadow AI governance requires a repeating cycle: new AI tools appear every week, employees will request exceptions, and your risk appetite for different app categories will evolve. Build this as a process, not a one-time project.

The Three-Tier AI App Classification Model

Tier 1 — Sanctioned

Reviewed, approved, DPA in place, compliant with data residency requirements. Examples: Microsoft Copilot M365, Azure OpenAI Service (org subscription). Full access from compliant devices.

🔶

Tier 2 — Monitored

Approved for specific teams or use cases. Access allowed with session monitoring (MDCA), DLP enforcement active, manager or CISO approval required. Examples: ChatGPT Enterprise (for marketing team only).

🚫

Tier 3 — Blocked

Not approved. Blocked at all three layers (MDCA + CA + network). Users who attempt access see a block page with instructions to request an exception through the formal process.

Exception Request Process

1

User Submits Request via ServiceNow / IT Portal

Form requires: business justification, data sensitivity level, AI app name, specific use case, manager approval, and confirmation that no Tier 1 tool covers the use case.

2

Security Team Reviews (SLA: 5 business days)

Check: GDPR DPA status, SOC 2 Type II, data retention policy, AI training data usage, encryption standards. Use the MDCA app catalog risk score as a baseline — any app scoring below 6/10 requires CISO approval.

3

Outcome: Promote to Tier 2, Deny, or Escalate

If approved: add user to exemption security group (grants time-limited CA exemption), add app to MDCA "Monitored" tag, configure session control policy. If denied: document reason, suggest Tier 1 alternative.

4

Quarterly Review

Every 90 days: review all active Tier 2 exceptions, check if business need still exists, re-evaluate app risk score (vendor may have changed their AI training data policy). Revoke exceptions that are no longer justified.

Roles and Responsibilities (RACI)

ActivityCISOSecurity OpsIT AdminBusiness Unit
Define AI classification policyA/RCCI
Review exception requestsA (>6.0 risk)RCI
Configure MDCA policiesIAR-
Configure Conditional AccessIAR-
Monitor KQL alerts / incidentsIR/AC-
Employee AI awareness trainingACCR
Quarterly policy reviewARCC

AI Policy Communication

ℹ️
Block pages should direct, not just deny A block page that says "Access Denied — Contact IT" creates shadow workarounds (mobile data, personal devices). A block page that says "This AI tool is not approved. Your organization provides Microsoft Copilot — use it at copilot.microsoft.com. Need a different tool? Submit a request at [link]." reduces shadow workarounds by giving users a legitimate path.

Metrics to Track Monthly

📊 Coverage Metrics

% of endpoints with MDCA tag enforcement active · % of users with GSA client deployed · # of AI apps discovered vs. classified · # of active exception approvals

⚠️ Risk Metrics

# of DLP policy match events on AI sites · # of Sentinel alerts for AI exfiltration · # of Tier 3 block bypass attempts · # of OAuth consents to AI apps

✅ Implementation Checklist — Shadow AI Governance

Discovery
  • Enable MDCA Cloud Discovery — connect MDE as agentless log source
  • Review Cloud Discovery dashboard — identify all AI apps in use across the organization
  • Tag all apps in the AI catalog: Sanctioned / Monitored / Unsanctioned
  • Enable App Governance — review OAuth consents to AI apps, revoke unauthorized
  • Create MDCA activity policy for AI data upload events → alert on high severity
Network Controls
  • Enable Microsoft Entra Internet Access (Global Secure Access) tenant-wide
  • Deploy GSA Client via Intune to all Windows devices
  • Create Web Content Filtering Policy — block "Generative AI" category
  • Add custom FQDN block list (api.openai.com, claude.ai, etc.) to GSA policy
  • Configure Azure Firewall / proxy FQDN filtering for on-premises AI block list
  • Configure MDE custom indicators (URL/domain block) for remote user enforcement
  • Enable MDE Network Protection in Block mode via Intune ASR policy
Conditional Access
  • Create CA policy: Block-External-AI-Apps (All Users, exclude AI-Approved-SG)
  • Create CA policy: Session control on monitored AI apps (MDCA proxy)
  • Create CA policy: Require compliant device to access any AI app
  • Link GSA Security Profile to CA policy for internet traffic enforcement
  • Run all new CA policies in Report-only mode for 2 weeks before enabling
Intune & Endpoint
  • Configure Windows MAM App Protection Policy — block copy/paste to unmanaged apps
  • Enforce Microsoft Edge as managed browser — restrict AI browsing to Edge
  • Update device compliance policy — require Defender for Endpoint risk level ≤ Medium
  • Configure custom block notification page — include approved AI alternative and exception request link
Purview DLP
  • Create Endpoint DLP policy targeting AI site FQDN list for file uploads
  • Add sensitive info types: PII, credit card, health records, source code
  • Add sensitivity label condition — block Confidential/Highly Confidential labeled content
  • Enable Adaptive Protection — link IRM risk levels to DLP enforcement
  • Set DLP alert notifications → route to Security Operations team
Hunting & Monitoring
  • Deploy Query 4 (correlated file access + AI visit) as Sentinel scheduled rule
  • Create Sentinel workbook for Shadow AI usage trends (weekly/monthly)
  • Set up monthly report: # of AI apps discovered, blocked, exceptions active
Governance
  • Publish AI usage policy — define Tier 1/2/3 classification and employee expectations
  • Create AI exception request workflow in IT portal (ServiceNow / Forms)
  • Assign RACI — who reviews exceptions, who owns monitoring, who updates the block list
  • Schedule quarterly review: re-evaluate all Tier 2 exceptions and app risk scores
  • Add Shadow AI module to security awareness training (Defender for Office 365 / KnowBe4)