Microsoft Purview (Security & Compliance PowerShell) Commands
Retention, DLP, eDiscovery and sensitivity labels through Connect-IPPSSession.All Microsoft Purview (Security & Compliance PowerShell) pages
- Connect-IPPSSession: connect to Security & Compliance PowerShell (Purview)Connect-IPPSSession from ExchangeOnlineManagement opens Security & Compliance PowerShell for Purview cmdlets; add -EnableSearchOnlySession for eDiscovery.
- Create a Purview DLP policy with PowerShell: New-DlpCompliancePolicy and New-DlpComplianceRuleA DLP policy needs New-DlpCompliancePolicy for locations and mode, then New-DlpComplianceRule for sensitive info types and actions. Test in simulation first.
- Get-Label: list sensitivity labels and label policies in Security & Compliance PowerShellGet-Label lists Purview sensitivity labels and Get-LabelPolicy shows who receives them. Both need Connect-IPPSSession; -SkipValidations helps with many labels.
- New-ComplianceSearch and Start-ComplianceSearch: run a Purview content search in PowerShellCreate the search with New-ComplianceSearch, run it with Start-ComplianceSearch, read counts with Get-ComplianceSearch. Connect with -EnableSearchOnlySession.
- Purview retention in PowerShell: New-RetentionCompliancePolicy, New-RetentionComplianceRule, New-ComplianceTagA retention policy is a policy plus a rule: New-RetentionCompliancePolicy sets locations, New-RetentionComplianceRule the duration. Labels: New-ComplianceTag.
- Search-UnifiedAuditLog: search the Microsoft 365 audit log with PowerShellSearch-UnifiedAuditLog runs in Exchange Online PowerShell and returns 100 records by default; -SessionCommand ReturnLargeSet with a SessionId pages to 50,000.