- The Semantic Index respects user permissions: Copilot never bypasses ACLs. If a user receives sensitive payroll or executive data in a response, it is because that data was overshared via
Everyone except external users(EEEU) in SharePoint/OneDrive. - Purview Sensitivity Labels are mandatory: Files encrypted with sensitivity labels that do not grant user
ExtractorViewrights are automatically excluded from grounding and semantic indexing. - Audit Copilot prompts and responses: Monitor Purview Unified Audit Log using the
CopilotInteractionrecord type to track prompt metadata, grounded files, and user IDs without decrypting private user prompt text.
When enterprises roll out Microsoft 365 Copilot, security and messaging administrators quickly realize a fundamental truth: Copilot does not cause data leaks; it exposes existing data oversharing.
Because Copilot operates on behalf of the authenticated user using Microsoft Graph and the Semantic Index, it has access to every SharePoint site, Teams channel, OneDrive file, email, and meeting transcript that the user has permission to read. If a confidential financial spreadsheet was inadvertently shared with "Everyone except external users", Copilot will surface that data in employee prompts within seconds.
This engineering runbook details how to establish Zero Trust data security before and during a Copilot deployment, audit high-risk overshared repositories, enforce Microsoft Purview sensitivity labels, and monitor Copilot activity using PowerShell.
1. The Core Threat: Oversharing via Broad Group ACLs
The number one security issue in organizations enabling Copilot is permission sprawl:
- Users creating public Teams where confidential company strategy documents are stored.
- SharePoint document libraries where sharing links were set to
"Anyone with the link"or"People in your organization". - Legacy intranet root sites granted to
Everyone except external users(EEEU).
When an employee prompts Copilot:
"Summarize the upcoming executive compensation plan and reduction-in-force strategy,"
If any document containing those keywords is accessible to Everyone except external users, Copilot reads the file, parses the data, and presents a detailed summary with direct citation links.
2. Restricting Copilot Scope via Restricted SharePoint Search (RSS)
If your organization has hundreds of legacy SharePoint sites and cannot audit every permission before launching Copilot, deploy Restricted SharePoint Search (RSS):
Restricted SharePoint Search allows administrators to curate an allowed list of up to 100 enterprise sites that Copilot and enterprise search are permitted to reference. All other SharePoint sites are excluded from Copilot grounding unless the user has explicitly opened or modified the file recently.
Managing Restricted SharePoint Search via PowerShell
# 1. Connect to SharePoint Online PowerShell
Connect-SPOService -Url "https://yourtenant-admin.sharepoint.com"
# 2. Check current Restricted SharePoint Search mode (Enabled or Disabled)
Get-SPOTenantRestrictedSearchMode
# 3. Enable Restricted SharePoint Search
Set-SPOTenantRestrictedSearchMode -Mode Enabled
# 4. Add Approved Enterprise Hub Sites to the Allowed List (up to 100 sites)
Add-SPOTenantRestrictedSearchAllowedList -SitesList @(
"https://yourtenant.sharepoint.com/sites/Approved-Corporate-Policies",
"https://yourtenant.sharepoint.com/sites/Employee-Handbook"
)
# 5. Verify Current Allowed List
Get-SPOTenantRestrictedSearchAllowedList
3. Auditing Overshared SharePoint Sites with PowerShell
To identify sites that have excessive broad access permissions, run this automated discovery script:
<#
.SYNOPSIS
Audit-CopilotOversharedSites.ps1
Scans SharePoint Online sites for broad "Everyone except external users" permissions.
#>
Import-Module PnP.PowerShell -ErrorAction Stop
$TenantAdminUrl = "https://yourtenant-admin.sharepoint.com"
Connect-PnPOnline -Url $TenantAdminUrl -Interactive
$allSites = Get-PnPTenantSite | Where-Object { $_.Template -notlike "SRCHCEN*" -and $_.Template -notlike "REDIRECT*" }
$findings = [System.Collections.Generic.List[PSCustomObject]]::new()
foreach ($site in $allSites) {
Write-Host "Auditing: $($site.Url)..." -ForegroundColor Cyan
try {
Connect-PnPOnline -Url $site.Url -Interactive
$groups = Get-PnPGroup
foreach ($group in $groups) {
$users = Get-PnPGroupMember -Identity $group.Title -ErrorAction SilentlyContinue
$hasEeeu = $users | Where-Object { $_.LoginName -like "*spo-grid-all-users*" -or $_.Title -like "*Everyone except external users*" }
if ($hasEeeu) {
Write-Host " [!] EXPOSURE FOUND: $($site.Title) grants access to Everyone except external users!" -ForegroundColor Red
$findings.Add([PSCustomObject]@{
SiteTitle = $site.Title
SiteUrl = $site.Url
Group = $group.Title
RiskLevel = "High (Copilot Grounding Exposure)"
})
}
}
} catch {
Write-Warning "Could not inspect $($site.Url): $($_.Exception.Message)"
}
}
$findings | Export-Csv -Path ".\Copilot-Overshared-Sites.csv" -NoTypeInformation
Write-Host "[+] Audit complete. Findings exported to Copilot-Overshared-Sites.csv" -ForegroundColor Green
4. Monitoring Copilot Interactions in Unified Audit Log (UAL)
Microsoft Purview logs every Copilot prompt interaction under the CopilotInteraction record type.
While Microsoft preserves user privacy by hashing or redacting the literal prompt content in standard audit logs, the log captures critical forensic metadata:
- The user who executed the prompt (
UserId). - The client application used (
Teams,Word,Excel,PowerPoint,Loop). - The specific files, emails, or meetings accessed and grounded (
AccessedResources). - The Purview sensitivity labels evaluated.
PowerShell Script: Extracting Copilot Interactions
# Connect to Exchange Online & Purview Compliance PowerShell
Connect-ExchangeOnline -ShowBanner:$false
Connect-IPPSSession -ShowBanner:$false
# Query Copilot Activity for the past 24 hours
$startDate = (Get-Date).AddDays(-1)
$endDate = Get-Date
Write-Host "Querying Copilot audit events between $startDate and $endDate..." -ForegroundColor Cyan
$auditLogs = Search-UnifiedAuditLog `
-StartDate $startDate `
-EndDate $endDate `
-RecordType CopilotInteraction `
-ResultSize 100
$results = foreach ($log in $auditLogs) {
$auditData = $log.AuditData | ConvertFrom-Json
[PSCustomObject]@{
Timestamp = $log.CreationDate
User = $log.UserIds
Operation = $log.Operations
AppHost = $auditData.AppHost
GroundedFiles = ($auditData.AccessedResources | Select-Object -ExpandProperty Name) -join "; "
Sensitivity = $auditData.SensitivityLabelId
}
}
$results | Format-Table Timestamp, User, AppHost, GroundedFiles -AutoSize
$results | Export-Csv -Path ".\Copilot-Audit-Events.csv" -NoTypeInformation -Encoding utf8
5. Summary Checklist: Copilot Pre-Deployment Security
- [x] Disable
Everyone except external userson sensitive SharePoint and OneDrive sites. - [x] Enable Restricted SharePoint Search (RSS) if enterprise data hygiene is still underway.
- [x] Deploy Purview Sensitivity Labels with encryption to block unauthorized grounding.
- [x] Turn on Purview AI Hub in the Microsoft Purview portal to monitor prompt risk and sensitive info types (SITs).
- [x] Schedule Weekly UAL Audits using
Search-UnifiedAuditLog -RecordType CopilotInteraction.