How to export Intune configuration profiles with PowerShell
Published
The Intune admin center has no bulk export. The script below reads your configuration profiles, settings catalog policies, administrative templates and compliance policies from Microsoft Graph and writes each one to a JSON file with its settings and its assignments.
Why export them
The Intune admin center keeps the current version of each profile and nothing else. There are three good reasons to keep your own copy:
- The built-in export is narrow. Settings catalog policies have Export JSON in the policy's menu under Devices > Manage devices > Configuration, one policy at a time. Template-based profiles, administrative templates and compliance policies have no export, and nothing exports the whole list.
- A deleted profile is gone. Intune has no recycle bin for policies. Without a copy you rebuild from memory, from screenshots, or from a device that has not checked in yet. How to get a deleted Intune policy back covers that day; this article is about the copy that makes it short.
- Change review and tenant copies. A dated export shows what a profile looked like before someone edited it, gives a reviewer something to read, and is the starting point when you build the same profile in a second tenant for a pilot, a merger or another customer.
What "configuration profile" covers in Microsoft Graph
The single list you see under Devices > Manage devices > Configuration comes from several collections in Microsoft Graph, each with its own address and its own shape. Compliance policies, under Devices > Manage devices > Compliance, are separate again, but they belong in the same export because Conditional Access depends on them.
| In the admin center | Graph collection | Graph version |
|---|---|---|
| Device configuration profiles from templates (device restrictions, Wi-Fi, VPN, certificates, custom OMA-URI) | /deviceManagement/deviceConfigurations | v1.0 and beta |
| Settings catalog policies, which also hold most endpoint security policies | /deviceManagement/configurationPolicies, settings at /{id}/settings | beta |
| Administrative templates | /deviceManagement/groupPolicyConfigurations, values at /{id}/definitionValues | beta |
| Compliance policies | /deviceManagement/deviceCompliancePolicies | v1.0 and beta |
As of November 2026, the Microsoft Graph reference documents configurationPolicies and groupPolicyConfigurations under beta only. Check the version selector on the reference page before you rely on v1.0 for them. The script uses beta for all four, so every file has the same shape and includes the newer profile types and properties that v1.0 does not carry. Microsoft supports the Intune beta APIs but changes them more often, so look at the output again now and then.
Each collection returns the policy without its assignments, and the settings catalog and administrative template collections return it without its settings. Those are separate requests per policy.
What you need
- The Microsoft Graph PowerShell SDK. The script uses only
Connect-MgGraphandInvoke-MgGraphRequestfrom the authentication module:Install-Module Microsoft.Graph.Authentication -Scope CurrentUser. PowerShell 7 or Windows PowerShell 5.1 both work. - One scope.
DeviceManagementConfiguration.Read.Allcovers all four collections. If nobody has consented to it for Microsoft Graph Command Line Tools in your tenant, the first sign-in asks an administrator to. - A role that can read Intune. Global Reader, Intune Administrator, or the Intune role Read Only Operator. With a delegated sign-in you get only what both the scope and your role allow, and scope tags can hide profiles from an administrator whose role is scoped.
The script sends only GET requests. It changes nothing in the tenant.
The export script
It writes one folder per type under a dated folder, one JSON file per policy holding the policy, its assignments and, where they exist, its settings or values, and a manifest.csv with one row per policy. Paging follows @odata.nextLink on every collection, the assignments and settings included.
# Microsoft Graph PowerShell SDK v2 (Microsoft.Graph.Authentication). Read-only: GET requests only.
param(
[string] $Root = ".\intune-export-$(Get-Date -Format 'yyyy-MM-dd')"
)
Connect-MgGraph -Scopes "DeviceManagementConfiguration.Read.All" -NoWelcome
$graph = "https://graph.microsoft.com/beta/deviceManagement"
# Each type: its collection, and the per-policy collections to read besides assignments.
$types = @(
@{ Name = 'deviceConfigurations'; Children = @() }
@{ Name = 'configurationPolicies'; Children = @('settings') }
@{ Name = 'groupPolicyConfigurations'; Children = @('definitionValues?$expand=definition,presentationValues') }
@{ Name = 'deviceCompliancePolicies'; Children = @('scheduledActionsForRule?$expand=scheduledActionConfigurations') }
)
# Every item of a collection, page by page.
function Get-GraphAll([string] $Uri) {
while ($Uri) {
$page = Invoke-MgGraphRequest -Method GET -Uri $Uri -OutputType PSObject
$page.value
$Uri = $page.'@odata.nextLink'
}
}
# A file name Windows accepts; the id keeps two policies with the same name apart.
function Get-SafeName([string] $Name, [string] $Id) {
$clean = ($Name -replace '[\\/:*?"<>|\p{Cc}]', '_').Trim([char[]]' .')
if ($clean.Length -gt 80) { $clean = $clean.Substring(0, 80).Trim([char[]]' .') }
if (-not $clean) { $clean = 'unnamed' }
"$clean-$Id"
}
$manifest = foreach ($type in $types) {
$folder = Join-Path $Root $type.Name
New-Item -ItemType Directory -Path $folder -Force | Out-Null
foreach ($policy in Get-GraphAll "$graph/$($type.Name)") {
$base = "$graph/$($type.Name)/$($policy.id)"
$export = [ordered]@{
policy = $policy
assignments = @(Get-GraphAll "$base/assignments")
}
foreach ($child in $type.Children) {
$export[$child.Split('?')[0]] = @(Get-GraphAll "$base/$child")
}
# Settings catalog policies use name; the others use displayName.
$name = if ($policy.displayName) { $policy.displayName } else { $policy.name }
$file = Join-Path $folder "$(Get-SafeName $name $policy.id).json"
$export | ConvertTo-Json -Depth 100 | Out-File -FilePath $file -Encoding utf8
[pscustomobject]@{
Type = $type.Name
Name = $name
Id = $policy.id
LastModifiedDateTime = $policy.lastModifiedDateTime
AssignmentCount = $export.assignments.Count
}
}
}
$manifest | Export-Csv -Path (Join-Path $Root 'manifest.csv') -NoTypeInformation -Encoding utf8
"Exported $(@($manifest).Count) policies to $Root"
Three details matter. The $expand strings are in single quotes so PowerShell does not read them as variables. ConvertTo-Json cuts anything deeper than -Depth into a plain string without warning, and settings catalog settings nest deeply, so keep the depth at 100. The full id in each file name is long, but two profiles can share a display name, and a name alone would let one file overwrite the other.
Administrative templates and compliance policies get one extra request each: the configured values of the template, and the actions for noncompliance (such as marking a device noncompliant after a grace period). Without them the export of those two types holds little more than a name.
What the export does not give you
- Group names. Assignments name their target by
groupId, and an assignment filter bydeviceAndAppManagementAssignmentFilterId. Export the groups and filters too, or at least a list of their ids and names, or the assignments will be unreadable after a group is deleted. - Secrets. Wi-Fi pre-shared keys, VPN shared secrets and passwords in some profiles come back empty, and custom OMA-URI values marked as encrypted come back encrypted. Certificate profiles refer to other profiles, such as the trusted certificate, by id. Those values have to be entered again by hand.
- A diff. Two exports are two folders. Nothing tells you what changed between them unless you build the comparison.
- A way back in. Importing is a separate POST per type. You remove the read-only properties first (
id,createdDateTime,lastModifiedDateTime,versionand similar), send the settings in the shape that type expects, add the values of an administrative template after the policy exists, and re-create the assignments through each policy'sassignaction, after checking that every group and filter still exists.
Keeping exports useful
Run the script on a schedule rather than when you remember. For that, use an app registration with the application permission DeviceManagementConfiguration.Read.All, admin consent and a certificate, and replace the sign-in line with Connect-MgGraph -ClientId $appId -TenantId $tenantId -CertificateThumbprint $thumbprint -NoWelcome. No user password sits in the task. Keep the dated folders somewhere that does not depend on the tenant they describe. To see what changed, compare two exports with a JSON-aware diff that ignores key order; the manifest's LastModifiedDateTime column tells you which files to look at first.
Where GlacierPoint Snapshot fits
If you would rather not maintain the script, the diff and the import, GlacierPoint Snapshot does all three. It backs up 484 setting types across 9 admin centers, more than 60 of them in Intune, including the four collections above with their settings, administrative template values and assignments. It compares any two backups setting by setting, and restores the settings you pick with a preview first and a rollback after. The user guide walks through a backup, a compare and a restore, and How to get a deleted Intune policy back shows what that looks like when a profile has been deleted.