Back up a virtual machine in Azure with an ARM template
Article
Azure Backup backs up on-premises machines and apps, and Azure VMs. This article shows you how to back up an Azure VM with an Azure Resource Manager template (ARM template) and Azure PowerShell. This quickstart focuses on the process of deploying an ARM template to create a Recovery Services vault. For more information on developing ARM templates, see the Azure Resource Manager documentation and the template reference.
An Azure Resource Manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses declarative syntax. You describe your intended deployment without writing the sequence of programming commands to create the deployment.
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. Alternatively, you can back up a VM using Azure PowerShell, the Azure CLI, or in the Azure portal.
If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button. The template will open in the Azure portal.
Review the template
The template used in this quickstart is from Azure quickstart Templates. This template allows you to deploy simple Windows VM and Recovery Services vault configured with the DefaultPolicy for Protection.
To deploy the template, select Try it to open the Azure Cloud Shell, and then paste the following PowerShell script into the shell window. To paste the code, right-click the shell window and then select Paste.
Azure PowerShell
$projectName = Read-Host -Prompt"Enter a project name (limited to eight characters) that is used to generate Azure resource names"$location = Read-Host -Prompt"Enter the location (for example, centralus)"$adminUsername = Read-Host -Prompt"Enter the administrator username for the virtual machine"$adminPassword = Read-Host -Prompt"Enter the administrator password for the virtual machine" -AsSecureString$dnsPrefix = Read-Host -Prompt"Enter the unique DNS Name for the Public IP used to access the virtual machine"$resourceGroupName = "${projectName}rg"$templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.recoveryservices/recovery-services-create-vm-and-configure-backup/azuredeploy.json"New-AzResourceGroup -Name$resourceGroupName -Location$locationNew-AzResourceGroupDeployment -ResourceGroupName$resourceGroupName -TemplateUri$templateUri -projectName$projectName -adminUsername$adminUsername -adminPassword$adminPassword -dnsLabelPrefix$dnsPrefix
Azure PowerShell is used to deploy the ARM template in this quickstart. The Azure portal, Azure CLI, and REST API can also be used to deploy templates.
Validate the deployment
Start a backup job
The template creates a VM and enables backup on the VM. After you deploy the template, you need to start a backup job. For more information, see Start a backup job.
Learn about Azure Backup before learning to implement Recovery Vaults and Azure Backup Policies. Learn to implement Windows IaaS VM recovery, perform backup and restore of on-premises workloads, and manage Azure VM backups.