Step 1: Create an Automation Account. Search for Automation and click Create.
Step 2: Then give it a Name, Resource group name and click create.
Step 3: Go into All Resource and click on the Automation object you created:
Step 4: Click on Modules Gallery and import AzureRM.profile to your Automation account.
Click Import, I Agree checkbox and click OK.
Step 5: Search for Recovery in the search box and import the 3 shown below also:
Step 6: Verify you have a Run As account.
If not please create one using the info below:
- Sign in to the Azure portal with an account that is a member of the Subscription Admins role and co-administrator of the subscription.
- From the Automation account blade, select Run As Accounts under the section Account Settings.
- Depending on which account you require, select either Azure Run As Account or Azure Classic Run As Account. After selecting either the Add Azure Run As or Add Azure Classic Run As Account blade appears and after reviewing the overview information, click Create to proceed with Run As account creation.
- While Azure creates the Run As account, you can track the progress under Notifications from the menu and a banner is displayed stating the account is being created. This process can take a few minutes to complete.
Step 8: Create a new Runbook. Add in the Name, Runbook Type must be PowerShell and description and click Create.
Step 9: Download the Powershell file as you will need to copy and paste the script info into your Azure Automation Policy
Step 10: Modify the settings below after you paste the code into the Runbook:
Step 9: Click on Test pane and test the report.
Step 10: Once you confirm the test is working properly you can Publish the Automation Job:
Step 11: Schedule it to run at your desired frequency.