Exporting your DLP and label policy configuration as a ZIP: useful, but not configuration as code

27 April 2026 · Samantha Kloos-Kilkens

The 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.

Polaroid photos scattered on a table Photo: Olivie Strauss on Unsplash

What you get

On the policies page of a solution that supports it, Export policies offers two options. Export to CSV gives you what the table on the page shows: name, status, last modified, that kind of summary. Export to zip is the interesting one: a ZIP file with an XML file that contains the full configuration of every policy in that solution at that moment, including rules, conditions, actions, scoping and priority where they apply. For label publishing policies the export includes the labels, and Microsoft's announcement mentions more detail about all sensitivity labels in the tenant.

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

The XML is a PowerShell CLIXML file, so 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
The property names differ per solution, so start with 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

Microsoft lists three uses, and I'd agree with all three. For support cases you attach the ZIP instead of spending an hour on a screen share walking an engineer through every rule. For change tracking you save a snapshot regularly, so that "who changed this DLP rule and what did it look like before" has an answer even when the audit log has rolled over or nobody thought to search it in time. And for analysis you can query the file locally, for example to find rules that still use a sensitive information type you're about to retire.

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' } } }
}
It compares case-sensitively, so a change that only alters letter case still shows up. The list of ignored properties is a starting point: anything that changes on every save makes every item look modified, so add properties to it when you see false positives in your own exports.

Why it isn't configuration as code

It's tempting to call a full XML export "config as code", but it misses the part that matters. Configuration as code means you describe the state you want, review changes to that description before they happen, and apply it, to the same tenant after a mistake or to a new tenant from scratch. The export is the opposite direction: it describes the state that is, after the fact, and there's no way back in.

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

That "something that can apply a configuration" is what my purview-as-code project does for labels, DLP and retention. I'd use the two together: the code describes what you want, the export shows what's really there.

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.

Written by an Argus IT expert

Want an expert like this in your team, or work like this yourself in security, IAM or cloud?

Samantha Kloos-Kilkens

Samantha Kloos-Kilkens

Sam has worked in security and identity for more than ten years, eight of them at Microsoft in the Identity and Network Access product group. She founded Argus IT in 2023 and has a soft spot for the hidden gems in Entra ID. CISSP, CCSP, CISM, CCSK and Microsoft Certified Trainer.

Stay in the Loop

Subscribe to our newsletter for a friendly nudge whenever we publish a new article or have news to share.