Managed Disk is now in GA - Convert all your VMs now!

Alright so this is kind of a big deal. This has been covered in the past but since this just hit General Availability, you need to get on this now. Or better, yesterday if you have access to a time machine.

Before Managed disks, you had to create an Azure Storage Account for each VM to avoid IOPS limits. But this wasn’t enough to keep your VMs up and running. You had to also manage availability sets.

This has led a some people as far away from VM as possible. But if you consider the insane advantages of VM Scale Sets (read: massive scale-out, massive machine specs, etc.), you don’t want to avoid this card in your solution deck. You want to embrace it. But if you start embracing VMs, you have to start dealing with the Storage Accounts and the Availability Sets and, let’s be honest, it was clunky.

Today, no more waiting. It’s generally available and it’s time to embrace it.

Migrating Existing VMs to Managed Disks

Note this code is taken from the sources bellow.

To convert single VMs without an availability set

1
2
3
4
5
6
7
# Stop and deallocate the VM
$rg = "MyResourceGroup"
$vm = "MyMachine"
Stop-AzureRmVM -ResourceGroupName $rg -Name $vm -Force

# Convert all disks to Managed Disks
ConvertTo-AzureRmVMManagedDisk -ResourceGroupName $rg -VMName $vm

To Convert VMs within an availability set:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
$rgName = 'myResourceGroup'
$avSetName = 'myAvailabilitySet'

$avSet = Get-AzureRmAvailabilitySet -ResourceGroupName $rgName -Name $avSetName

Update-AzureRmAvailabilitySet -AvailabilitySet $avSet -Managed

foreach($vmInfo in $avSet.VirtualMachinesReferences)
{
$vm = Get-AzureRmVM -ResourceGroupName $rgName | Where-Object {$_.Id -eq $vmInfo.id}
Stop-AzureRmVM -ResourceGroupName $rgName -Name $vm.Name -Force
ConvertTo-AzureRmVMManagedDisk -ResourceGroupName $rgName -VMName $vm.Name

}

Source 1
|
Source 2

Here’s some more resource that may help you convert your VMs.

If you are using the Azure CLI, they updated their tooling to allow you to manage the “Managed Disks”.

If you rather use C# to manage your application, the .NET Azure SDK is also up to date.

Finally, if you want to start playing with VM Scale Sets and Managed Disks, here’s a quick “how to”.

Are Managed Disks something that you waited for? Let me know in the comments!