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.
As a Cloud Engineer, I wrote a quick PowerShell script to audit an entire tenant for these "zombie" resources.
The Solution
We 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.
Here is the core logic:
powershell
$disks = Get-AzDisk
foreach ($disk in $disks) {
if ($null -eq $disk.ManagedBy) {
Write-Host "Orphan Found: $($disk.Name)"
}
}
Get the Full Script
I have published a robust version of this tool on my https://github.com/LordTalyn1984/LordTalyn1984. It scans all subscriptions and generates a CSV report for your finance team.
View the Code on GitHub
Why This Matters
For a standard Premium SSD (P30), you could be wasting over $130/month per disk. In a large environment, I've seen this script uncover thousands of dollars in wasted spend in under 5 minutes.
Gavin Dobbs is a Cloud Engineer specializing in Azure Governance and Automation. Connect with me on https://www.linkedin.com/in/gavin-dobbs-texas/.
Top comments (0)