This post is about creating an Intune backup to a storage account Pt.2. You could use this to create a daily backup or even more frequent.
The clarify the above. I created a script that creates a backup from your Intune environment and uploads it to a storage account.
This part is about running the script in an Azure Automation Account. This enables the option to schedule your Intune Backup! Let’s go!
Intune Backup to Storage Account Pt.1 – The Script
Intune Backup to Storage Account Pt.3 – The Notification
Complete the previous part in this series:
Intune Backup to Storage Account Pt.1
After that, you are ready to start this blog!
Creating the Automation Account
Firstly, log on to Microsoft Azure.
After that, search for Automation Account:
Click on create:
Your automation account is created!
Preparing the Automation Account
Go to the just created Automation Account. We need to add to some modules to the account. The modules give us the option the run the backup and the upload inside the storage account.
Go the modules option of the storage account:
The Az module is already present in the automation account. You see these modules already available in the account.
Click on “Add a module”:
Select browse from gallery and click on “Click here to browse from gallery”:
Search for “Intunebackup” and select the appropriate module:
After that, click on select:
Select the runtime version and click on import:
Furthermore, do the same for the “Microsoft.Graph.Intune” module.
Adding the script in a runbook
Firstly, go to the automation account and select “Runbooks”:
After that, click on create a runbook:
Next, name the runbook, select the type and runtime version:
After that, you need to copy the script from my github repository and paste it in the runbook:
Furthermore, you need to edit the parameters:
In addition, this are the same variables as in part 1!
TenantID: Your tenantname
ClientID: The App ID from the Service Principal
StorageAccountName: The name of your storageaccount
RGName: ResourceGroupName for the StorageAccount
Container: ContainerName within the StorageAccount
Lastly, we need to add the secret as an encrypted variable. Go to variables:
After that, click on “Add a variable”:
Enter the parameters:
This is what it should look like:
Running the Automation Account
And finally! We can run the Intune Backup to a Storage Account. Click on start:
By default, all the parameters are filled with the values that we entered earlier:
Click on “OK” to start the runbook.
After that, the backup starts:
Lastly, the backup is uploaded to your storage account:
This is the result (the same as in part 1)
Scheduling the Automation Account/Runbook
Go back to the automation account and click on schedules:
Click on “Add a schedule”:
Enter the variables for the schedule:
And that creates the daily Intune Backup!
That concludes the Intune Backup to Storage Account Pt.2