Using PowerShell to Carry Out Conversion Operations on Disks: From Managed to Unmanaged and Vice-Versa

Using PowerShell to Carry Out Conversion Operations on Disks: From Managed to Unmanaged and Vice-Versa

The technological path of our times has taken us to virtual machines (VMs) and emancipated operating systems from tangible hosts. With cutbacks in a lot of power resources that once was needed for physical systems, virtual machines continue to stretch the boundaries of benefits that prevail. Virtual machines in Azure utilize disks to contain all operating systems, applications as well as data. Azure storage services can provide for intelligent storage management that complements the virtue of the virtual machine. With speed, dexterity, and security, virtual machine disks are being designed to deliver enterprise-grade durability. Azure awards its users with both unmanaged and managed disk systems in its two performance tiers. And with these disks, it also gives out the essential tools to work around them with ease. Azure already offers a myriad of options for working around disks and managing your storage with the help of its web-based UI Azure Portal. But one thing to be kept in mind is that- what all its UI can do, can also be done on a command-line interface known as PowerShell.

A Brief Look at Unmanaged and Managed Disks

Unmanaged Disk Types are your traditional type of disks that are usually used in virtual machines. With these disk types, you have complete control in maximizing storage capability and performance for your storage accounts. You can create your own storage accounts and specify those accounts while creating the disk. Now, you have to keep in mind that the scalability targets of the storage account is 20,000 IOPS so you should take care that you do not exceed this limit. You must be wondering what happens if you exceed the maximum scalability target for a storage account? In that case, the Virtual Machine may stop working. You have to create storage accounts to hold the disks (VHD files) for your Azure VMs. Also, when scaling up, we have to make sure you created additional storage accounts, so we do not exceed the IOPS limit for storage with any of your disks.

A feature like TRIM makes the unmanaged disk efficient as it ensures the user is billed only for the space being utilized. Azure Managed Disks simplifies disk management for Azure IaaS VMs by managing the storage accounts associated with the VM disks. The user is left with the sole task of specifying the details of the type and size of the disk they desire. Azure creates the disk and continues to manage it.

On the other hand, you have Managed Disk types. And as the name suggests, they are automatically managed for your needs. The managed disks handle storage account from its creation to management for you in the background. That is, even if one add/remove VMs, all the management is done by Azure for you. Also, you do not have to worry about scalability limit with Managed disks. One major benefit of Managed Disks is that it gives you the ability to create hundreds of Virtual Machines for a single storage account. Let’s look at other benefits of managed disks:

  • As already mentioned above, Managed disks allow the VM storage not to be bound by limits of the subscribed account limits.
  • Taking into consideration the above point, this further boosts the scalability of VMs.  This feature is accompanied by appropriate efficiency in the form of the placements of Availability Sets in different storage scale units (stamps).
  • Azure Role-Based Access Control (RBAC) can be utilized for modulating permissions for multiple user interference in a managed disk.
  • Cost considerations for managed disks rely on several elements. To begin with, costing initiates with the selection of a performance tier, that is Premium and Standard storage. Managed disks ensure that users are billed for the provisioned size, the number of transactions and data transfers.
  • Another interesting feature provided by Managed Disks is the use of Images and Snapshots. These two mechanisms that record the state of a disk or a Virtual Machine, with the intention of keeping copies later meant to be replicated. That is, capturing an image of a deallocated VM will include records of all the disks that the VM holds and thus, the mage can be utilized to create another VM with all the disks.

Using PowerShell for Conversion Operations

A good disk management plan would involve a smart use of both the disk types. Therefore, there might be times where you would want to convert a disk from one type to another. Some of us might be comfortable at using an interface based on commands rather than graphics; and sometimes rather than a simple choice, it becomes a requirement to opt for a much faster method. PowerShell is developed to efficiently handle computing operations such as configuration management and task automation. It includes a scripting language, command-line shell, and is based on the .NET framework. Let us now look at the use of PowerShell in carrying out conversions on disk. You’ll be looking at converting unmanaged disk type to manage.

You will be referring to In Azure Portal for typing the correct properties of your VM in the PowerShell script. You should be familiar with the script for migration to managed disk type. Here is an example of how it looks like:

You can now start typing fundamental information of your VM in the script. Start by typing information such as the name of the resource group, the name of availability set, and so on. The main function of the PowerShell script is to get all the machines from your availability set, and then convert the machine’s disks to managed disks. It will first update the availability set with managed disk and then it will get the availability sets and VMs within it.

In a brief sense, it will first stop the VM and convert all the disks to managed disk type.

You will be trying something out here as you will verbose the output. The function of the verbose message stream is to deliver information about command processing that is used for debugging a command.

After entering all the required details in the script, you are all set to run this. But before that, please make sure that you are already logged in to your Azure account in PowerShell. Once you run the PowerShell script, it will now start the conversion of unmanaged to managed disks.

You have to wait till the time the script gets executed.


As already mentioned above, Azure lets you have a combination of both managed and unmanaged disk types so that you utilize the maximum benefit from both the disk types. However, using such combinations can be tricky and involve thorough exposure to the Azure storage services and associated features. With the ability of Azure to go virtually limitless, this cloud-based service is here to stay for a longer time. In recent years, this cloud-based platform has been gaining prominence in the IT world. With increased use, there is a rise in demand for cloud experts and data scientists who specialize in handling Azure and its features.

In short, big companies and smaller organizations are opting for Azure services and are always on a lookout for personnel with a wide range of experience in cloud-based and associated services. If you want to learn more about these PowerShell scripts, disk types, and Azure Storage– check out our course Azure MasterClass: Manage Storage and Disks in the Cloud with Azure Storage.

This course comes with a 30-day money back guarantee. If you feel this course doesn’t meet your needs, you just need to message us, and we’ll immediately refund your money. No questions asked. No hoops to jump through. No hard feelings.

What are you waiting for? It’s time to take action. Become an expert and generate a more significant income for you and your family.

Let’s do this together!

Leave a Reply

Your email address will not be published. Required fields are marked *