Deleting orphan disks in Windows Azure

Microsoft updated Windows Azure Portal yesterday to make it easier to delete all Virtual Machines for a Cloud Service along with its associated VHD’s. Previously when you deleted virtual machines you had to manually delete the disks associated with this VHD. This led to situations where you had a large number of unattached disks in your Azure storage account.

You can find out if you have unattached disks by running the following PowerShell commands.

Get-AzureDisk | Where {! $_.AttachedTo } | Select DiskName

You can also delete the disk and the VHD using the following command.

Get-AzureDisk | Where {! $_.AttachedTo } | Select DiskName | Remove-AzureDisk –DeleteVHD

 

This entry was posted in IAAS, PowerShell, Storage, Windows Azure. Bookmark the permalink.