Stop Burning Money: How to Find Orphaned Azure Disks with PowerShell
Source: Dev.to
The Invisible Cost of the Cloud
One of the most common “silent killers” in Azure billing is the orphaned managed disk. When you delete a virtual machine in Azure, the default behavior often leaves the OS and data disks behind. These disks sit in your resource group, unattached, doing nothing—but you are still paying for them every single month.
Script to Find Orphaned Disks
You can use the Get-AzDisk cmdlet to inspect the ManagedBy property. If this property is $null, the disk is not attached to any compute resource.
$disks = Get-AzDisk
foreach ($disk in $disks) {
if ($null -eq $disk.ManagedBy) {
Write-Host "Orphan Found: $($disk.Name)"
}
}
Full Script
A more robust version of this tool that scans all subscriptions and generates a CSV report is available on GitHub:
https://github.com/LordTalyn1984/LordTalyn1984
Why This Matters
For a standard Premium SSD (P30), you could be wasting over $130/month per disk. In large environments, this script has uncovered thousands of dollars in wasted spend in under five minutes.