Export & import your Intune tenant settings

If you’ve ever run into the need to change tenants (maybe your tenant trial has ended or you want to move settings from development to production), you may have noticed that there is no quick way to export settings from Intune. In this step-by-step post, we’ll go over using PowerShell to easily migrate settings.

1. Open a new tab and download the latest Intune PowerShell scripts from https://github.com/microsoftgraph/powershell-intune-samples. Save the .zip file into the downloads folder. Right-click on the powershell-intune-samples-master zip file and select Extract all > Extract.

2. Run PowerShell as an Administrator and accept the UAC popup. Run Set-ExecutionPolicy Bypass.

3. Run Install-Module AzureAD. Approve installing the module.

4. Run cd C:\Users\*YourUserAccount*\Downloads\powershell-intune-samples-master\powershell-intune-samples-master\DeviceConfiguration

If you’re looking to export other content from Intune, you would select another folder during this step and run that corresponding PowerShell script. Other options here include Company Portal Branding, Enrollment Restrictions, and Terms and Conditions.

5. Run .\DeviceConfiguration_Export.ps1

6. Sign-in using your Intune administrator account. Select the checkbox to consent on behalf of your organization and click Accept.

8. The next step is to provide the export location. Run C:\Users\*YourUserAccount*\Downloads\powershell-intune-samples-master\powershell-intune-samples-master\DeviceConfiguration

Now all of our settings are exported! We’ll follow the same general process for importing, except specifying the exported JSON file.

9. Run .\DeviceConfiguration_Import_FromJSON.ps1

10. Open the C:\Users\*YourUserAccount*\Downloads\powershell-intune-samples-master\powershell-intune-samples-master\DeviceConfiguration folder. While holding shift, copy as path the configuration profile. Paste into the PowerShell window.

11. Navigate back to the Azure Portal.

12. On the left navigation bar, click All Services > Intune. Click on Device Configuration and verify the profiles are duplicated. Since I reused my same tenant for this demo, I’ll see that the Autopilot Reset profile is duplicated:

You may also like...

19 Responses

  1. sam says:

    IIs there a way to import the MDMMigrationAnalysis.html into Intune once its created to save having to create each setting individually?

  2. loenders nick says:

    Is it also possible with this to set up one tenant perfectly with compliance policies, gpo’s and apps and such and then export it and import it into all my other tenants, so I don’t have to do all the settings everytime again?

  3. Kosipeich says:

    Is it possible to migrate intune configuration settings from one intune environment to another? As in can I grab your setting json files and import them in my intune? I noticed json files contain a number of guid-alike items

  4. Adam says:

    Any way to export Administrative Template-based settings? They don’t seem to get exported with the above script.

  5. NickOff says:

    Hi Janusz, it works perfectly except one of our huge Custom profile, getting below error. Have you seen this before, any tips?

    Response content:
    {“error”:{“code”:”BadRequest”,”message”:”Unable to read JSON request payload. Please ensure Content-Type header is set and payload is of valid JSON format.”,”innerError”:{“date”:”2021-07-04T10:59:11″,”request-id”:”5befa7df-f856-410e-babd-66ed047827b1″,”client-request-id”:”5befa7df-f856-410e-babd-66ed047827b1″}}}
    Add-DeviceConfigurationPolicy : Request to https://graph.microsoft.com/Beta/deviceManagement/deviceConfigurations
    failed with HTTP Status BadRequest Bad Request
    At C:\temp\powershell-intune-samples-master\DeviceConfiguration\DeviceConfiguration_Import_FromJSON.ps1:343 char:1
    + Add-DeviceConfigurationPolicy -JSON $JSON_Output
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-DeviceConfigurationPolicy

  6. R Hates says:

    I have AzureADPreview installed, do I need to unistall it and install AzureAD module instead?

    • R Hates says:

      I guess the answer is Yes, because I see this:-
      Checking for AzureAD module…
      AzureAD PowerShell module not found, looking for AzureADPreview

  7. sisi says:

    When I ran .\DeviceConfiguration_Export.ps1 it doesnt actually export in .csv format only .json but in the screenshot it shows both csv and json. Am I running the correct script? Thanks!

    • Janusz says:

      Looks like they updated that .ps1 script to only export .json’s now… I’d recommend using the latest scripts as I’m sure there are other improvements, but here’s a .zip of the 2019 Intune PowerShell Samples scripts with the deviceconfiguraiton_export.ps1 that also exports a csv: powershell-intune-samples-master.zip

  8. Diego says:

    Hi Janusz, I don’t know what’s going on but with both old and new script no file are made, *.json or *.csv.

    No error on powershell, folder has been created but it’s empty :-/

  9. phil says:

    When exporting csp I get the isencrypted values set so I can’t re-import them.. what am I missing? is there some flag I am missing?

    “secretReferenceValueId”: “12345678990”,
    “isEncrypted”: true,
    “value”: “****”

    • Janusz says:

      I’m not too familiar with this – but when I search the repository the isEncrypted flag only shows up for Managed Devices. Is that the case? Because you can’t import devices into your tenant, they would need to be reenrolled.

  10. nitinkumar says:

    I am getting the same issues
    When exporting csp I get the isencrypted values set so I can’t re-import them.. what am I missing? is there some flag I am missing?

    “secretReferenceValueId”: “12345678990”,
    “isEncrypted”: true,
    “value”: “****”

  1. January 20, 2021

    […] If this will be a net new Intune environment, one way to save time would be to import your old settings. This won’t import the assignments, but at least all of your configurations will be the same. We wrote a detailed guide on this process in a previous blog post: Export & import your Intune tenant settings – Device Advice […]

Leave a Reply

Your email address will not be published. Required fields are marked *