Exporting your DLP and label policy configuration as a ZIP: useful, but not configuration as code
27 April 2026 · Samantha Kloos-KilkensThe policies pages for DLP and for sensitivity label publishing have an Export to zip option, in preview since March and generally available since mid-April (the rollout runs into May). It gives you a point-in-time snapshot of all policy configuration in that solution as XML, rules and conditions included. As far as I know, that's the first time the Purview portal hands you the full picture in one file, and it solves a few real problems. It's also easy to read more into it than it does, so this post covers both.
Photo: Olivie Strauss on Unsplash
What you get
What you don't get is just as important. You can't pick individual policies, the ZIP always contains all of them. It's read-only and for reference only: you can't import it back to restore a policy or create one in another tenant. And it's a snapshot, it doesn't change when your configuration changes.
Reading it with PowerShell
Import-Clixml turns it back into objects. That runs locally and doesn't connect to anything, which also means you can hand the file to a colleague or an auditor without giving them access to the tenant: $p = Import-Clixml -Path "C:\Exports\dlp-policies.xml"
$p | Get-Member -MemberType Properties
$p.DlpCompliancePolicies | Format-Table Name, Mode, Priority
$p.DlpComplianceRules | Format-Table Name, ParentPolicyName
Get-Member to see what's in your export. The objects look like what Get-DlpCompliancePolicy and Get-DlpComplianceRule return, which is convenient if you already have scripts that work with those. Where it helps
The change tracking use gets much better if you compare snapshots instead of only keeping them. This script compares two extracted exports and lists what was added, removed or changed, by name, per collection:
param(
[Parameter(Mandatory = $true)] [string]$OldXml,
[Parameter(Mandatory = $true)] [string]$NewXml,
[string[]]$IgnoreProperties = @('WhenChanged', 'WhenChangedUTC', 'LastModifiedTime', 'DistributionStatus')
)
$old = Import-Clixml -Path $OldXml
$new = Import-Clixml -Path $NewXml
function Get-Fingerprint($item) {
$item | Select-Object -Property * -ExcludeProperty $IgnoreProperties | ConvertTo-Json -Depth 10 -Compress
}
$collections = @(($old | Get-Member -MemberType Properties).Name) + @(($new | Get-Member -MemberType Properties).Name) | Sort-Object -Unique
foreach ($collection in $collections) {
$before = @{}; foreach ($i in @($old.$collection)) { if ($i.Name) { $before[$i.Name] = Get-Fingerprint $i } }
$after = @{}; foreach ($i in @($new.$collection)) { if ($i.Name) { $after[$i.Name] = Get-Fingerprint $i } }
foreach ($name in $after.Keys) { if (-not $before.ContainsKey($name)) { [pscustomobject]@{ Collection = $collection; Name = $name; Change = 'Added' } } }
foreach ($name in $before.Keys) { if (-not $after.ContainsKey($name)) { [pscustomobject]@{ Collection = $collection; Name = $name; Change = 'Removed' } } }
foreach ($name in $after.Keys) { if ($before.ContainsKey($name) -and $before[$name] -cne $after[$name]) { [pscustomobject]@{ Collection = $collection; Name = $name; Change = 'Changed' } } }
}
Why it isn't configuration as code
That doesn't make it less useful. A regular export is the safety net for everything that is still configured by hand in the portal, and an honest record of what's actually live, which is worth having even when you do manage policies from code. But if the goal is repeatable deployments across tenants, you still need something that can apply a configuration, not just read it.
Update November 2026
There's also a PowerShell route now. Since the end of April,
Export-PurviewConfig in Security & Compliance PowerShell is documented: it produces a ZIP with configuration for DLP, sensitivity labels, classification and data lifecycle management. It's export only as well.Export the DLP policies in your tenant today, store the ZIP somewhere with a date in the name, and do it again next month so you have two snapshots to compare.
The script from this post is also on GitHub, in purview-scripts.
Sources
- Export policy configuration in Microsoft Purview (Microsoft Learn)
- What's new in Microsoft Purview, April 2026 (Microsoft Learn)
- Import-Clixml (Microsoft Learn)
- MC1235741: Microsoft Purview | Data Loss Prevention: Export DLP and label policy configurations (Message center, via merill.net)
- Export-PurviewConfig (Microsoft Learn)