How to get a deleted Intune policy back
Published
Someone deleted a configuration profile, or cleared the wrong assignment, and devices are already checking in. Here is what you can still do, and what to set up so the next time takes minutes.
The short answer
Intune has no recycle bin for policies. A deleted compliance policy, configuration profile, settings catalog policy or app protection policy is gone, and Microsoft cannot bring it back for you. What you can do is rebuild it, and how well depends on what was saved before.
If you have nothing saved
- Look in the audit log. In the Intune admin center, Tenant administration > Audit logs shows who deleted the policy and when. For some changes it lists the properties that were modified, but it does not hold the whole policy, so it tells you what to rebuild rather than how.
- Look at a device. A device that has not checked in since the deletion still has the settings applied. Its settings report can help you write the policy again.
- Look for a sibling. A test tenant, a copy of the policy made for a pilot group, or documentation with screenshots.
Then recreate the policy and assign it to the same groups. Until you do, devices stop receiving it at their next check-in; which settings they actually lose depends on the platform and the setting, as What happens when an Intune policy is deleted? explains.
Export your policies before it happens
For a single settings catalog policy, the admin center has Export JSON on the policy, and Create > Import policy to bring it back. For everything at once, use Microsoft Graph PowerShell. Reading needs DeviceManagementConfiguration.Read.All:
Connect-MgGraph -Scopes "DeviceManagementConfiguration.Read.All"
# Settings catalog and endpoint security policies, with their settings
$uri = "https://graph.microsoft.com/beta/deviceManagement/configurationPolicies"
(Invoke-MgGraphRequest -Uri $uri).value | ForEach-Object {
$settings = Invoke-MgGraphRequest -Uri "$uri/$($_.id)/settings"
$assigned = Invoke-MgGraphRequest -Uri "$uri/$($_.id)/assignments"
@{ policy = $_; settings = $settings.value; assignments = $assigned.value } |
ConvertTo-Json -Depth 30 | Out-File "intune-$($_.id).json"
}
Three things are easy to miss:
- Intune is many lists, not one. Settings catalog policies, older device configuration profiles, compliance policies, administrative templates, app protection policies, scripts, update policies and enrollment settings each have their own address in Microsoft Graph. An export of one is not an export of Intune.
- Settings and assignments are separate requests. Reading the list of policies returns neither. A policy restored without its assignments applies to nobody.
- Secrets are not returned. A Wi-Fi password or a similar secret inside a policy is never given back by Microsoft and has to be entered again.
Assignments name groups and filters by id. If the group is gone too, the assignment cannot be put back until the group exists again.
For a complete script that covers configuration profiles, settings catalog policies, administrative templates and compliance policies, with paging and a manifest, see How to export Intune configuration profiles with PowerShell.
What GlacierPoint Snapshot does
It backs up 484 configuration types across Microsoft 365, more than 60 of them in Intune, each with its settings and its assignments, on demand or on a schedule. When a policy is deleted:
- Compare shows it as missing, next to everything else that changed since the backup.
- You tick the policy, look at the preview, and confirm. It is created again with its settings and assigned to the same groups.
- The restore is recorded in a journal on your computer and can be rolled back.
Restored automatically today: compliance policies, device configuration profiles, settings catalog and endpoint security policies, administrative templates, app protection and app configuration policies, scripts and remediations, Windows update policies, assignment filters, scope tags and roles. Some types, such as Windows Autopilot deployment profiles and connectors to Apple or Google, are backed up and compared, and restored by hand with the saved values shown beside the right page of the admin center. The coverage page has the full list.
The app runs on your computer and signs in as you; we hold no access to your tenant. Every permission is listed by name.