How do I restore a VM in Azure?
There are multiple options for restoring a virtual machine in Azure.
Create a new VM
Quickly creates and gets a basic VM up and running from a restore point.
Restores a VM disk which can then be used to create a new VM.
You can restore a disk and use it to replace a disk on the existing VM.
Note: You can also recover specific files and folders on an Azure VM.
If you're running the latest version of Azure Backup for Azure VMs (known as Instant Restore), snapshots are kept for up to seven days, and you can restore a VM from snapshots before the backup data is sent to the vault. If you want to restore a VM from a backup from the last seven days, it's quicker to restore from the snapshot and not from the vault.
Some details about storage accounts:
- Create VM: When you create a new VM, the VM will be placed in the storage account you specify.
- Restore disk: When you restore a disk, the disk is copied to the storage account you specify. The restore job generates a template that you can download and use to specify custom VM settings. This template is placed in the specified storage account.
- Replace disk: When you replace a disk on an existing VM, Azure Backup takes a snapshot of the existing VM before replacing the disk. The snapshot is stored in the staging location (storage account) you specify. This storage account is used to temporarily store the snapshot during the restore process, and we recommend that you create a new account to do this, that can be easily removed afterwards.
- Storage account location : The storage account must be in the same region as the vault. Only these accounts are displayed. If there are no storage accounts in the location, you need to create one.
- Storage type : Blob storage isn't supported.
- Storage redundancy: Zone redundant storage (ZRS) isn't supported. The replication and redundancy information for the account is shown in parentheses after the account name.
- Premium storage:
- When restoring non-premium VMs, premium storage accounts aren't supported.
- When restoring managed VMs, premium storage accounts configured with network rules aren't supported.
Select a restore point
- In the search bar at the top, search for Recovery Services Vault and click on the item returned.
- Click on the name of your recovery services vault. In this example, we’re looking for myRecoveryServicesVault.
- In the vault associated with the VM you want to restore, click Backup items > Azure Virtual Machine.
- Click on your VM. In this example mine is called sorobert-TestVM. By default on the VM dashboard, recovery points from the last 30 days are displayed. You can display recovery points older than 30 days, or filter to find recovery points based on dates, time ranges, and different types of snapshot consistency.
- To restore the VM, click Restore VM.
- Select a restore point to use for the recovery. In this example, click on the one labeled Application Consistent and click on OK. It is our most recent full backup.
Choose a VM restore configuration
- In Restore configuration, select a restore option. In this example, select Replace Existing. The other options are detailed below:
- Create new: Use this option if you want to create a new VM. You can create a VM with simple settings, or restore a disk and create a customized VM.
- Replace existing: Use this option if you want to replace disks on an existing VM.
- Select Replace Disks and the storage account we created above as the staging location and click on OK.
- After your operation is validated, click on Restore.
Track the restore operation
After you trigger the restore operation, the backup service creates a job for tracking. Azure Backup displays notifications about the job in the portal. If they aren't visible, click on the Notifications symbol to see them.
Track restore as follows:
- To view operations for the job, click the notifications hyperlink. Alternatively, in the vault, click Backup jobs, and then click the relevant VM.
- To monitor restore progress, click any restore job with a status of In-progress. This displays the progress bar which displays information about the restore progress:
- Estimated time of restore: Initially provides the time taken to complete the restore operation. As the operation progresses, the time taken reduces and reaches zero when the restore operation finishes.
- Percentage of restore. Shows the percentage of restore operation that's done.
- Number of bytes transferred: If you're restoring by creating a new VM, it shows the bytes that were transferred against the total number of bytes to be transferred.
There are a number of things to note after restoring a VM:
- Extensions present during the backup configuration are installed, but not enabled. If you see an issue, reinstall the extensions.
- If the backed-up VM had a static IP address, the restored VM will have a dynamic IP address to avoid conflict. You can add a static IP address to the restored VM.
- A restored VM doesn't have an availability set. If you use the restore disk option, then you can specify an availability set when you create a VM from the disk using the provided template or PowerShell.
- If you use a cloud-init-based Linux distribution, such as Ubuntu, for security reasons the password is blocked after the restore. Use the VMAccess extension on the restored VM to reset the password. We recommend using SSH keys on these distributions, so you don't need to reset the password after the restore.
- Connect to the VM a verify that the file TextFile.txt has been restored.
Backing up restored VMs
- If you restored a VM to the same resource group with the same name as the originally backed-up VM, backup continues on the VM after restore.
- If you restored the VM to a different resource group or you specified a different name for the restored VM, you need to set up backup for the restored VM.