>NULL: December 2022

Friday 30 December 2022

Restoring an Azure VM to earlier disk state from backups (unmanaged disks)

Restore the disks from backup and use Storage Browser in the Azure Portal to place them where you want them, please note they will restore to the root of your Storage Account.

Open Cloud Shell in the Azure Portal and use the following commands to set variables, read the VM configuration, and update the VM configuration with the new OS disk location. 


# Variables for you to fill in

$ResourceGroup = 'RG-Classic'

$VMname = 'winclassic'


#Get the VM config to a variable

$VM = Get-AzVM –Name $VMname –ResourceGroupName $ResourceGroup


#Stop and deallocate the VM

Stop-AzVM –Name $VM.Name –ResourceGroupName $VM.ResourceGroupName –Force


#Swap out the OS disk using the VM variable

$VM.StorageProfile.OsDisk.Vhd.Uri = 'https://rgunmanageddisknew.blob.core.windows.net/vhds/rhclassic-os-2317.vhd' #example, use your new OS disk uri


#Update the VM configuration

Update-AzVM –VM $VM –ResourceGroupName $ResourceGroup


You can now verify the disk location has changed by clicking on the disk in the VM/Disks section and looking at the location.

Data disks can be swapped out within the Azure Portal GUI.