Azure Restore doing an OS Unmanaged Disk Swap


I came across a situation recently that involved restoring an existing Azure VM using unmanaged disks. Keyword unmanaged disks – there is a bunch of info onUnlike my familiar world of VMware, Azure is a different animal. Disks, storage accounts, Nics, VM configurations, NSG (Firewalls), Load balancers, Availability Groups are all objects that connect in a symbiotic environment in order to operate. Changing a link in that environment like a disk takes a delicate dance to ensure things can be restored or replaced in order to operate. Its not as straight forward as simply replacing a VHD and starting up the VM.

I had a heck of a time finding the steps I needed to replace the bad disk with the restored disk. Trying a simple restore of the VHD and putting it in the blob container didk not work. What I found was that you actually need to link the disk using powershell.

Here’s what I did to get things back up and running.

i) Install Azure Powershell module via powershell? Type in
? ? ? Install-Module -Name AzureRM -AllowClobber

ii) Install Azure Storage explorer and sign in



  1. Restore the VHD disk with the restore point you desired by creating a new VHD disk with the restore point
    1. (Do NOT try to restore on the existing disk – it only works with managed disks)
    2. Choose a storage account (the same one is fine because it creates a new blob container)
  2. Wait for a long time (exaggerated) for the restore
  3. Go in storage explorer and copy the restored disk URI in the blob container of the VM you will need this later.
  4. Run this handy script (copied from this guys’ handy article-?

#region Logon to Azure


$subscription = Get-AzureRmSubscription | Out-GridView -PassThru

Select-AzureRmSubscription -SubscriptionId $subscription.Id


# Variables for YOu to fill in

$ResourceGroup = ‘Resource_group_name’ # resource group name to contain the new NIC

$VMname = ‘your_vm_name’ # name of the VM you want to swap out the OS disk

#Get the VM config to a variable

$VM = Get-AzureRmVM -Name $VMname -ResourceGroupName $ResourceGroup

#Stop and deallocate the VM

Stop-AzureRmVM -Name $VM.Name -ResourceGroupName $VM.ResourceGroupName -Force

#swap out the OS disk using the VM variable

$VM.StorageProfile.OsDisk.Vhd.Uri = ‘’

#Update the VM configuration

Update-AzureRmVM -VM $VM -ResourceGroupName $ResourceGroup

? ? ? ? 5.? Start up your VM.

6. Verify everything looks good.



Many thanks to this article.?

For managed OS disk swaps you can find the following Azure article?