What Are Azure Managed Disks?

In today’s Ask the Admin, I’ll look at how Microsoft is making it easier to provision disks in Azure.

Azure Storage provides scalable, durable, and highly available storage, and to facilitate this, there are two types of storage account that can be used to provision blob, table, queue, file storage, and virtual machine (VM) hard disks. Until recently, creating a virtual disk in the Azure cloud required working directly with a storage account, but Managed Disks can be created while leaving Azure to create and manage the necessary storage account.



In more complex scenarios, such as using Virtual Machine Scale Sets (VMSS) to create thousands of identical VMs, Managed Disks automate storage account scale management. Managed Disks now allow VMSS to scale up to one thousand VMs in a single set, 10 times more than was possible with unmanaged disks.

Managed Disks are Azure Resource Manager (ARM) resources, and as such can be managed using JSON templates. As part of this release, Snapshots and Images are also now ARM resources. For more information on working with ARM templates, see What are Microsoft Azure Resource Groups? and Export Azure Resource Group as a JSON Template on the Petri IT Knowledgebase. But probably the best news is that existing ARM VMs can be converted to Managed Disks with just a reboot.

For more information on creating VMs in Azure, see Create a Virtual Machine in the Azure Cloud on Petri.

Unmanaged vs. Managed Disks

Let’s have a look at how the process of using a Managed Disk for a VM differs in PowerShell. When using unmanaged disks, you first need to create a storage account, using the New-AzureRmStorageAccount cmdlet, and a URI for the OS disk:

And finally, set the OS disk for the new VM using Set-AzureRmVMOSDisk:

Managed Disks

But using Managed Disks, we can skip the process of creating a storage account and defining a URI for the disk. All we need to do is specify the disk name, storage account type, and a few other parameters:

The VM can then be provisioned using the New-AzureRmVM cmdlet. For a complete guide to deploying ARM VMs using PowerShell, see Deploy VMs Using Azure Resource Manager and PowerShell on Petri.

Convert a VM to Managed Disks

Existing ARM VMs in your Azure subscription can be converted to Managed Disks using the ConvertTo-AzureRmVMManagedDisk cmdlet. First, stop the VM you want to convert using the code below, replacing myResourceGroup and myVM with a resource group and VM name as appropriate:

Once the status of the VM has changed to Stopped (Deallocated), use ConvertTo-AzureRmVMManagedDisk to convert all disks associated with the VM to Managed Disks:

In this article, I explained how Azure Managed Disks differ from unmanaged disks and how to convert existing ARM VMs to Managed Disks.

Related Topics:

  • Cloud Computing

    Don't have a login but want to join the conversation? Sign up for a Petri Account

    IT consultant, contributing editor @PetriFeed , and trainer @Pluralsight . All about Microsoft, Office 365, Azure, and Windows Server.