if you import an Intune Backup via the Powershell Module (IntuneBackupAndRestore), it does not assign a group automatically. There is no option in that module. This blog features a script that assigns a group automatically to all imported profiles. The script assigns the following policies:

  • Configuration Policies
  • Administrative Templates
  • Windows Update Policies
  • Compliance Policies
  • Powershell Scripts

The script assigns 1 group to all profiles/policies. If you want to assign separate groups to different profiles/policies, feel free to cut the script into multiple pieces. After that, you can run it separately.

I have also created a script that uses the IntuneBackupAndRestore module to import and export your Intune Configuration.

This blog features both scripts.

Prerequisites

I assume that you already have an Intune template that you use to quickly set up a new Intune environment. This blog imports that template and assigns it.

The template (folder) would look like this:

Import Intune Backup and Assign Group - Intune Template

If you don’t have an Intune backup read about how to create one here and/or here.

After that, you need to install the proper modules in Powershell in order to use the appropriate commands. Use this code to do so:

Install-Module -Name IntuneBackupAndRestore
Install-Module -Name Microsoft.Graph.Intune

Furthermore, you will probably have these modules already since you have created the Intune Backup in the first place.

Import the Intune Backup

Firstly, we need to import the Intune Backup. Use this command to log on:

Connect-MSGraph

After that, you can start the import. Use the following command:

Start-IntuneRestoreConfig -Path C:\temp\IntuneBackup

In addition, this is the import of very basic configuration for Intune:

Import Intune Backup - example

Assign the configuration in Intune

After the import is completed, all the configurations are available in Intune. For example:

The problem is that none of them are assigned to a group. I wanted to automate this also. I wrote a couple of functions that use the Microsoft Graph to gather the policies and assign them to a single group.

You can find the script on my GitHub.

Furthermore, if you don’t want to assign everything to a single group, you can put the functions in separate files and go from there.

Copy the file from my Github and save it as a .ps1 file. In addition, you also need to grab the object ID of the Azure AD group that you want to assign. For example:

This group was created in my previous post. This creates an Autopilot Profile, Dynamic Group, and assigns the dynamic group to the autopilot profile. Check it out here.

Run the script to assign the policies using the following code:

.\Function_AssignCompleteConfiguration.ps1 -AzureADGroup 1fb2f056-b111-41c8-aae4-c93a75a3e33e

Use the AzureADGroup parameter accordingly.

After that, the script runs and assign everything for you:

When we check in Intune, the appropriate group is assigned:

And that’s how you import an Intune Backup and Assign a group in seconds!

2 thoughts on “Import Intune Backup and Assign Group”
  1. Thanks for this, is there a way to get this working with profiles that use the Settings catalog and endpoint protection policies

    1. Hi,

      Yes, there is. I would have to create custom script to backup these policies and import them again.

      Thanks,
      Niels

Leave a Reply

Your email address will not be published.