/purview-compliance:purview-compliancefrom purview-compliance
Provides deep expertise in Microsoft Purview compliance workflows including DLP policies, retention/sensitivity labels, eDiscovery, audit log queries, and compliance playbooks with risk-ranked recommendations and legal dependency flags.
Ships in purview-compliance. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
workflows/multi-plugin-workflows.md.This skill provides comprehensive knowledge for managing Microsoft Purview compliance features via Graph API and Security & Compliance PowerShell. All guidance is risk-ranked, auditable, and explicit about assumptions and legal dependencies.
docs/integration-context.md| Workflow | tenantId | subscriptionId | environmentCloud | principalType | scopesOrRoles |
|---|---|---|---|---|---|
| DLP, retention, eDiscovery, compliance playbooks | required | optional (Azure-linked evidence only) | AzureCloud* | delegated-user | Compliance.Read.All, SecurityEvents.Read.All, AuditLog.Read.All |
* Use sovereign cloud values from the canonical contract when applicable.
Fail fast before compliance queries when required context is missing or invalid. Redact tenant/object identifiers in outputs.
Graph API: https://graph.microsoft.com/v1.0
Graph Beta: https://graph.microsoft.com/beta
Compliance PS: Connect-IPPSSession
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /security/cases/ediscoveryCases | Create eDiscovery case |
| GET | /security/cases/ediscoveryCases | List all cases |
| GET | /security/cases/ediscoveryCases/{id} | Get case details |
| PATCH | /security/cases/ediscoveryCases/{id} | Update case |
| POST | /security/cases/ediscoveryCases/{id}/close | Close case |
| POST | /security/cases/ediscoveryCases/{id}/reopen | Reopen case |
| POST | /security/cases/ediscoveryCases/{id}/custodians | Add custodian |
| GET | /security/cases/ediscoveryCases/{id}/custodians | List custodians |
| POST | /security/cases/ediscoveryCases/{id}/legalHolds | Create legal hold |
| POST | /security/cases/ediscoveryCases/{id}/searches | Create search |
| POST | /security/cases/ediscoveryCases/{id}/searches/{id}/estimate | Estimate search results |
| POST | /security/cases/ediscoveryCases/{id}/reviewSets/{id}/export | Export review set |
Create eDiscovery case body:
{
"displayName": "HR Investigation 2026-Q1",
"description": "Investigation into data handling compliance",
"externalId": "CASE-2026-0042"
}
Add custodian body:
{
"email": "[email protected]",
"applyHoldToSources": true
}
Create legal hold body:
{
"displayName": "Litigation Hold - HR Case",
"description": "Preserve all mailbox and OneDrive content for custodians",
"isEnabled": true,
"contentQuery": "subject:'Project Alpha' OR from:[email protected]"
}
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /security/informationProtection/sensitivityLabels | List sensitivity labels |
| GET | /security/informationProtection/sensitivityLabels/{id} | Get label details |
| Method | Endpoint | Purpose |
|---|---|---|
| POST | /security/auditLog/queries | Create audit log query |
| GET | /security/auditLog/queries/{id} | Get query status |
| GET | /security/auditLog/queries/{id}/records | Get query results |
Create audit log query body:
{
"displayName": "DLP policy matches last 7 days",
"filterStartDateTime": "2026-02-22T00:00:00Z",
"filterEndDateTime": "2026-03-01T00:00:00Z",
"operationFilters": [
"DlpRuleMatch",
"DlpRuleUndo",
"DlpInfo"
],
"recordTypeFilters": [
"complianceDLPSharePoint",
"complianceDLPExchange"
]
}
The audit log query is asynchronous. Poll GET /security/auditLog/queries/{id} until status is succeeded, then fetch records.
Audit log query statuses: notStarted, running, succeeded, failed.
| Cmdlet | Purpose |
|---|---|
Get-DlpCompliancePolicy | List DLP policies |
New-DlpCompliancePolicy | Create DLP policy |
Set-DlpCompliancePolicy | Update DLP policy |
Remove-DlpCompliancePolicy | Delete DLP policy |
New-DlpComplianceRule | Add rules to a policy |
Set-DlpComplianceRule | Update rule conditions/actions |
Set-DlpCompliancePolicy -Mode Enable | Promote from test to enforcement |
Get-DlpSensitiveInformationType | List available sensitive info types |
Get-DlpDetailReport | Get DLP incident details |
| Mode | Description |
|---|---|
Enable | Policy actively enforces rules |
TestWithNotifications | Matches are detected, tips shown, but not blocked |
TestWithoutNotifications | Matches detected silently — for initial testing |
Disable | Policy is off |
Use confidence levels to reduce false positives:
| Cmdlet | Purpose |
|---|---|
Get-ComplianceTag | List retention labels |
New-ComplianceTag | Create retention label |
Get-RetentionCompliancePolicy | Check policy status and scope |
New-RetentionCompliancePolicy | Create retention policy |
New-RetentionComplianceRule | Publish label via policy |
| Action | Description |
|---|---|
Delete | Delete content after retention period |
Keep | Keep content indefinitely (no delete) |
KeepAndDelete | Keep for period, then delete |
Best practices:
| Cmdlet | Purpose |
|---|---|
Get-Label | List sensitivity labels |
New-Label | Create sensitivity label |
New-LabelPolicy | Publish labels to users |
Set-Label | Update label configuration |
Best practices:
| Operation | Permission / Role |
|---|---|
| DLP policy management | Compliance Administrator |
| Retention policy management | Compliance Administrator or Records Management |
| Sensitivity label management | Compliance Administrator or Information Protection Admin |
| eDiscovery (standard) | eDiscovery Manager |
| eDiscovery (premium) | eDiscovery Administrator |
| Retention labels with record declaration | Records Management role |
| Audit log queries | AuditLog.Read.All (Graph) or Audit Logs role |
| Sensitivity label reading (Graph) | InformationProtectionPolicy.Read |
| eDiscovery case management (Graph) | eDiscovery.Read.All / eDiscovery.ReadWrite.All |
# Connect to Security & Compliance PowerShell
pwsh -Command "Import-Module ExchangeOnlineManagement; Connect-IPPSSession -UserPrincipalName '[email protected]'"
| Status Code | Meaning | Common Cause |
|---|---|---|
| 400 Bad Request | Malformed query or filter | Invalid operationFilters, bad date format in audit query |
| 401 Unauthorized | Authentication failure | Expired token, missing scope consent |
| 403 Forbidden | Insufficient permissions | Missing eDiscovery or compliance role |
| 404 Not Found | Resource not found | Wrong case ID, deleted search |
| 409 Conflict | Operation conflict | Legal hold prevents deletion; case is closed |
| 429 Too Many Requests | Throttled | Implement exponential backoff with Retry-After header |
GET to verify before POSTstatus is succeeded@odata.nextLink for additional pagesGet-DlpSensitiveInformationType — identify target sensitive info typesNew-DlpCompliancePolicy -Mode TestWithNotifications — create policy in test modeNew-DlpComplianceRule — add detection rules with confidence levelsGet-DlpDetailReportSet-DlpCompliancePolicy -Mode Enable — promote to enforcementPOST /security/cases/ediscoveryCases — create case with external IDPOST .../custodians — add custodians with applyHoldToSources: truePOST .../legalHolds — create targeted legal hold with content queryPOST .../searches — create search with date range and keyword filtersPOST .../searches/{id}/estimate — estimate result volume before exportPOST .../reviewSets/{id}/export — export for legal reviewNew-ComplianceTag — create retention label (e.g., 7-year keep-and-delete)New-RetentionCompliancePolicy — create policy with adaptive scopeNew-RetentionComplianceRule — publish label via policyGet-DlpCompliancePolicy — inventory all DLP policies and their modesGet-RetentionCompliancePolicy — inventory retention policies and scopesGet-Label — inventory sensitivity labels and their protection settingsPOST /security/auditLog/queries — query for policy match events in last 30 daysEvery compliance workflow should follow:
Common filters for audit log queries:
| Filter | Example |
|---|---|
| By operation | "operationFilters": ["DlpRuleMatch"] |
| By record type | "recordTypeFilters": ["complianceDLPSharePoint"] |
| By user | "userPrincipalNameFilters": ["[email protected]"] |
| By date range | "filterStartDateTime" / "filterEndDateTime" |
| Record Type | Description |
|---|---|
complianceDLPSharePoint | DLP matches in SharePoint/OneDrive |
complianceDLPExchange | DLP matches in Exchange |
microsoftTeams | Teams activity |
sharePointFileOperation | File operations in SharePoint |
exchangeAdmin | Exchange admin operations |
azureActiveDirectory | Entra ID operations |
purview-compliance/commands/setup.mdpurview-compliance/commands/dlp-audit.mdpurview-compliance/commands/retention-review.mdpurview-compliance/commands/sensitivity-check.mdpurview-compliance/commands/ediscovery-workflow.mdpurview-compliance/README.md| Topic | File |
|---|---|
| DLP policy REST API, rules, SIT conditions, endpoint DLP, Teams DLP, PowerShell cmdlets | references/dlp-policies.md |
| Sensitivity label REST API, label taxonomy, auto-labeling, encryption settings, container labeling | references/sensitivity-labels.md |
| Retention policy creation, label publication, event-based retention, disposition review, preservation lock, adaptive scopes | references/retention-policies.md |
| eDiscovery Standard vs Premium, case/custodian/hold/search/export API, KQL queries, review sets | references/ediscovery.md |
| Compliance playbook patterns, remediation workflows, audit patterns | references/playbook-patterns.md |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub thelobbi/claude-m --plugin purview-complianceOther plugins' skills for the same job