Backup an unsupported Azure Windows VM

Before Azure Backup supported Windows Server 2008 guests early March 2020, not to be confused with 2008 R2 SP1, you couldn’t create an application consistent backup using the Recovery Services vault (RSV); essentially no live backups.

Thankfully this isn’t a problem for 2008 guests anymore, although I found it rather surprising that Microsoft was encouraging 2008 workloads to be migrated into Azure around mid-2018, but hadn’t provided support to install the Windows VM Agent for Windows Server 2008 guests until nearly two years after their announcement to entice customers to migrate.

The Azure VM Agent integrates with the Azure platform, providing the ability to reset local admin accounts, install additional Extensions and as a requirement to perform live backups using RSV. In lieu of this absence during this time, you had two options:

  • Deallocate the guest, include it into a backup policy in RSV and trigger a backup:
    • This option should also work with other unsupported guests, including Linux-based VM's in a deallocated state
    • While you can trigger ad-hoc backups, the guest needs to be associated with a backup policy that has a weekly backup schedule at a minimum
    • The caveat to this, weekly backup will trigger a failure when the VM is running as RSV will attempt and fail to backup the guest, generating a Azure Backup failure alert every time
    • To successfully back up the guest, you will need to schedule a regular outage; not a conducive option
  • Another workaround I evaluated was creating a disk clone using Disk2VHD:

Important: This method is not an effective way to perform regular backups and was tested as a proof-of-concept. Please consult with a trusted IT vendor or integrator to implement a proper backup solution.

    • You can run this while the OS is running and it will creates a complete disk image of the target volume
    • If you use this for a custom legacy Windows image (for example, Windows Server 2003) that is currently running as an Azure VM 
    • With a bit of effort, this could script this to run automatically
    • To restore the VM in back into Azure, there is a fair bit of heavily lifting (more on this later)
  1. To get started, download and extract Disk2VHD onto the guest

  2. To back up the OS volume (C:\) and assuming the backup location is E:\ with adequate capacity, run the following

disk2vhd C: E:\MyVM_OSDisk.vhd -accepteula 

Depending on the guest specifications, load and volume size, this will take a while, so please be patient.

Believe it or not, that was the easy part; the requirements to utilize this backup requires much more effort. While Azure generally supports the VHD format and just recently began supporting the VHDX format, it does not support Dynamic disks; only Fixed sized disks.

Disk2VHD creates a clone as a Dynamic disk, which will need to be converted to a Fixed sized disk using Convert-VHD as part of the restore process. The gotcha’s:

  • This requires the Hyper-V role and Management tools
  • To do this completely entirely in Azure, you will also need a nested VM; a Dv3 or great v3 VM, to install the Hyper-V and Management tools and run the Convert-VHD cmdlet

With all that taken care of, you can then convert the disk into a fixed size disk:

Convert-VHD –Path E:\ MyVM_OSDisk.vhd –DestinationPath E:\ MyVM.vhd -VHDType Fixed
  1. To can either use AzCopy or Azure Storage Explorer to upload the fixed sized VHD as a Managed Disk

  2. Finally, swap the OS disk under the VM > Disks blade and select [Swap OS Disk] to select the uploaded Managed Disk.