Back to articles
Stop Burning Money: How to Find Orphaned Azure Disks with PowerShell
How-ToDevOps

Stop Burning Money: How to Find Orphaned Azure Disks with PowerShell

via Dev.to DevOpsGavin Dobbs

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 W

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
2 views

Related Articles