If you have been reading this series through the first two posts, then by now you are familiar with ARM, VM and networking templates, and the new Azure Portal. Maybe you have even tried it for yourself, and created some new VMs using templates, or created a new network with a VPN gateway. If so, then in a week if you decide to delete all that and start over creating it again, with ARM templates it is SO easy to do!
But in some cases, you may create and use a VM for something more permanent, and at that point you will start to think about Azure backups. If you read Part 1 of my posts on ARM, then you’ll remember there is a caveat to ARM VMs, at least for right now. Azure automatic backups only work for ‘Classic’ VMs, NOT those created using ARM templates. IaaS v1 VMs are fine, just not v2. So for now, use those template VMs as the machines you can blow away and start over, and use classic VMs for anything you need to automatically backup.
Creating a Classic VM
So, what’s different about creating a classic VM? Well, if you followed the first example in my previous post on how to create VMs using the Azure portal, then not much! Just choose Classic for the VM creation, and make sure to choose Classic in the dropdown for VM type. That’s it.
Adding Backup Vault
We will also need an Azure Backup Vault. This part we actually can create with an ARM template. We can just launch the quickstart template directly from here. You can also edit the template before launch if the default setup isn’t right for you. But for a simple backup, it is equivalent to a quick-configure using the Azure Management site. Once you Create the template, you will see it on the Dashboard deploying template for a moment before the backup vault is created.
Once the vault is created, you will see it in a resource group in your Azure portal. Notice the little icon next to the vault name. This means that the resource cannot be edited in the new portal, and clicking the item will return you to manage.azure.com. I’m sure this will change in the future, but for now we have to do the rest of our backup configuration from outside the portal.
Adding VMs to Backup Vault
It make take a few minutes for that link to work. Then, we can add our classic VMs to the Backup Vault. First, let the vault Discover any available VMs.
Then select Register and you will see a list of compatible VMs. If your VM of choice is not in the list, it’s likely your VM was created with ARM. Scroll up to read how to create a Classic VM instead.
Once registered, we can select the VM to protect and configure the protection. Most of these steps are pretty self-explanatory for this part. You can use the Default Policy in most cases, or configure more specifically with a custom policy.
Now your VM will be backed up on schedule. You may want to trigger the initial backup immediately as I did here. Then you can view the backup under Jobs. Remember, the VM does not need to shut down in order to backup to the Vault.
Restoring a VM
Now that we have a backup, how can we use it to restore the VM? Just a few simple steps and you can use the recovery point to restore the original VM or make an exact copy. Choose Restore from the dashboard:
You will be prompted to select a recovery point and give a name for the restore instance. Azure is also warning me that there may be cost implications of creating this VM (as with any VM creation). You will be able to see the restore operation under Jobs.
And that’s it! Now I have 2 copies of my classic Azure VM, and my VM is protected with the Azure Backup Vault if I want to (or have to) restore it again.