This tutorial describes how to deploy an Azure Backup Recovery Services vault to back up multiple Azure VMs using PowerShell.
In this tutorial you learn how to:
Create a Recovery Services vault and set the vault context.
Define a backup policy
Apply the backup policy to protect multiple virtual machines
Trigger an on-demand backup job for the protected virtual machines
Before you can back up (or protect) a virtual machine, you must complete the prerequisites to prepare your environment for protecting your VMs.
Svarīgi
This tutorial assumes you've already created a resource group and an Azure virtual machine.
Sign in and register
Sign in to your Azure subscription with the Connect-AzAccount command and follow the on-screen directions.
PowerShell
Connect-AzAccount
The first time you use Azure Backup, you must register the Azure Recovery Service provider in your subscription with Register-AzResourceProvider. If you've already registered, skip this step.
A Recovery Services vault is a logical container that stores backup data for protected resources, such as Azure VMs. When a backup job runs, it creates a recovery point inside the Recovery Services vault. You can then use one of these recovery points to restore data to a given point in time.
In this tutorial, you create the vault in the same resource group and location as the VM you want to back up.
Azure Backup automatically handles storage for backed up data. By default the vault uses Geo-Redundant Storage (GRS). Geo-redundancy ensures that backed up data is replicated to a secondary Azure region, hundreds of miles away from the primary region.
Create the vault as follows:
Use the New-AzRecoveryServicesVault to create the vault. Specify the resource group name and location of the VM you want to back up.
Many Azure Backup cmdlets require the Recovery Services vault object as an input. For this reason, it's convenient to store the Backup Recovery Services vault object in a variable.
Backups run in accordance with the schedule specified in the backup policy. When you create a Recovery Services vault, it comes with default protection and retention policies.
The default protection policy triggers a backup job once a day at a specified time.
The default retention policy retains the daily recovery point for 30 days.
To enable and backup up the Azure VM in this tutorial, we do the following: