Microsoft has released a number of powershell sample script on github. After playing around with them for a bit I have found some cool and powerful use cases that I want to share. The first one is about creating and reusing compliance policies across multiple customer tenants.
Let us assume that you have created a set of compliance policies inside a test tenant and have landed on the compliance policies you want to reuse as a baseline for your customers. We have downloaded the Intune Samples scripts from github
Now we want to move into the folder \CompliancePolicy\ and find and execute the script that is called CompliancePolicy_Export.ps1. The first time we run the script it will as you to log on and create an access token and ask for permissions on your tenant. This requires you to have the AzureAD v2 powershell module installed.
So after we have done this, the compliance policies should be in the folder we assigned as JSON files and .csv files.
Import baseline into customer tenant
Now we are ready to import these settings into any tenant we are implementing or managing. The only thing we need to do is to take the JSON files as input and import them one by one. Of course you could do this even more automated by going through the folder and picking up all the JSON files at once. In my example I am importing them one by one. Take a look at this video to see how this looks when importing the policies into a new tenant.