Automate On-Demand backups for Azure Virtual Machines using Azure Powershell Documentation
Create additional recovery points beyond the automatic single day limitation of Azure Backup for Virtual Machines with up to 10 years of retention
Create an Automation Account with “Run As” account
Add Powershell Modules from Module Gallery (Under "Shared Resources") in Automation Account.
Import in the order given below:
- Az.Accounts (used for auth)
- Az.RecoveryServices
- Az.Resources (used for tags)
- Az.Automation (used for running other runbooks)
Make sure to update modules using https://github.com/Microsoft/AzureAutomation-Account-Modules-Update
Create a PowerShell Runbook in the Automation Account.
Past the powershell script directly into editor.
- Save the script
- Test the script using “Test Pane”
- Publish the Runbook
Schedule the Runbook for recurring runs
Pass the parameters required for the PowerShell Script;
By default this automation will trigger backup of [ALL] Virtual Machines in [ALL] Vaults in [SPECIFIED] Subscription
- SubscriptionID
- Specific Vaults (CSV Array)
- Specific Virtual Machines (CSV Array)
- Retention (in Days)
Monitor the success of the Runbook by selecting the Runbook, selecting "Resources" and finally selecting “Jobs”