Unused disks are the most common issue in Microsoft Azure, how does this happen?
Many operations require the deletion of the Virtual Machine and the deletion itself doesn’t remove the disk attached.
A VM deletion may happen because, we need to delete a virtual machine, or maybe during a migration, or because we need to move a VM from a VNet to another and we delete the old one, these many reasons for that.
First thing we need to do is listing all disks and we can use PowerShell, Azure API, or Azure resource Explorer.
The best option to automate this process is Azure API, below one of the calls
The call works requires the subscription ID, for that reason I use Aziverso, which gives me the possibility to call the API for multiple values and subscriptions and get the result in one single Excel sheet.
In Aziverso, from the voice menu I click on subscription to download all subscriptions in my Azure EA.
I open the Recon feature and I select the subscription sheet.
I search for the Microsoft.Compute/disks Azure API and I click OK.
Aziverso will create a list with all disks across all subscriptions with related links to the portal
I only need to filter the Excel sheet property column , properties.diskState = Unattached, to have all unattached disks.
Now I can easily clean up my cloud from unused disks navigating on each disk using the link.