Cost Optimization options for unattached Azure Managed Disks

Background
Users often find themselves in a situation where they have managed disks in one or more subscriptions that are no longer attached to a Virtual Machine (VM). These disks may have been attached to a VM in the past that has now either been deleted, or these disks were detached from the VM for some other reason. The user would continue to pay for these unattached disks, whether they need them or not.
Solution
A common issue users face is that either the owners of the disks cannot be identified, or it is not possible to simply delete the disks because their content must be kept around in case it is needed.
There are a few solutions that the user can employ (listed below in order of complexity – Low to High).
- Delete the unattached disk.
- Change the performance tier of the disk to the lowest one possible.
- Take a snapshot of the disk and delete the original one.
- Export the disk as a VHD to hot or cold Blob storage and delete the original disk.
Identifying unattached disks, and deleting them, if need be, can be accomplished by reviewing the following articles.
- Find and delete unattached Azure managed and unmanaged disks - Azure portal (https://learn.microsoft.com/en-us/azure/virtual-machines/disks-find-unattached-portal)
- Find and delete unattached Azure managed and unmanaged disks (https://learn.microsoft.com/en-us/azure/virtual-machines/windows/find-unattached-disks)
Let’s explore these options in greater detail.
Delete unattached disks
If you are certain that the unattached managed disks and their data will not be needed, you can choose to identify and delete them by following the steps outlined in the abovementioned articles.
This option should be used with great care as deleting a disk is an irreversible process. It would be prudent to backup the data on these disks by utilizing Azure Backup (https://learn.microsoft.com/en-us/azure/backup/backup-managed-disks) or exploring other options discussed in this article.
Change the disk’s performance tier
The performance tier of your Azure managed disk determines the IOPS and throughput your managed disk has.
You can change the performance tier of managed disk that is unattached to a lower tier, by reviewing the instructions provided on this page.
- Change your performance tier using the Azure portal (https://learn.microsoft.com/en-us/azure/virtual-machines/disks-performance-tiers-portal).
For example, you can set the performance tier of a zone-redundant Premium SSD to a locally redundant Standard HDD, which has a lower cost. Please ensure that you review the tradeoffs of changing the tiers and availability settings of the disk.
Take a snapshot and delete the disk
A snapshot is a point-in-time backup of an Azure disk. You can take snapshots of both attached and unattached disks, whether they are Operating System or data disks.
If you have an unattached Premium SSD managed disk with a provisioned size of 64GB, you would be paying some cost for that disk. You may only be using 5GB of that disk, but you have to pay for the provisioned size of 64GB. One way to optimize this cost would be to take a snapshot of this disk and store it in the cheapest tier, which would be locally redundant Standard HDD. At the time of this writing these snapshots are charged at $0.05/GB per month for both Standard LRS and ZRS options based on the used portion of the disk.
You can review the managed disk and snapshot pricing at this page.
- Managed Disks pricing (https://azure.microsoft.com/en-us/pricing/details/managed-disks/)
Once you have created the snapshot, you can choose to delete the managed disk. In case you need to recreate the disk, you can do so from the snapshot.
Please review the following articles for the creation of snapshots and the creation of disks from snapshots.
- Create a snapshot of a virtual hard disk (https://learn.microsoft.com/en-us/azure/virtual-machines/snapshot-copy-managed-disk?tabs=portal)
- Create a managed disk from a snapshot with PowerShell (https://learn.microsoft.com/en-us/azure/virtual-machines/scripts/virtual-machines-powershell-sample-create-managed-disk-from-snapshot)
Export the disk to Blob storage and delete the disk
Depending upon the particular situation, this option offers the maximum saving for storing a copy of the unattached managed disks. It is especially well suited if it is unlikely that you will be needing the unattached managed disks frequently. You can choose to export the disk to Blob storage, either hot or cold tier and delete the managed disk.
The following article explains how you can export the managed disk to Blob storage.
- Export/Copy a managed disk to a storage account using the Azure CLI (https://learn.microsoft.com/en-us/azure/virtual-machines/scripts/copy-managed-disks-vhd-to-storage-account). Please note that the resulting blob name should have an extension of VHD if you wish to create a managed disk from it. Storing managed disks as Blobs is currently only supported for Hot and Cold tiers.
Note: If you choose any option besides deleting the managed disks, make sure that you store relevant metadata with the snapshot or blob object which can help you identify the necessary information when you need to recreate the source managed disk. Relevant data could be, but not limited to, business owner’s name, cost center, region and subscription information etc.
Published on:
Learn moreRelated posts
Vector Search with Azure SQL, Semantic Kernel and Entity Framework Core
Vector databases like Qdrant and Milvus are specifically designed to efficiently store, manage, and retrieve embeddings. However, many applica...
NVIDIA NIM on Azure AI Foundry
Upcoming Updates for Azure Pipelines Agents Images
To ensure our hosted agents in Azure Pipelines are operating in the most secure and up-to-date environments, we continuously update the suppor...
TLS 1.3 support in Azure Cosmos DB
This article follows announcement on a previous article that mentioned the end of support for Transport Security Layer (TLS) 1.0/1.1. TLS 1.3 ...
Power Pages | Azure AD B2C | Claims mapping
In my previous blog post : [Step by Step] Power Pages : Set up Azure AD B2C I explained the steps to set up Azure AD B2C tenant and configure ...
Azure Data Factory: Read CSV file, Transform and push data to Dataverse
Let’s try to create a simple scenario that we can do in Azure Data Factory! Azure Data Factory is a serverless data integration service ...