Windows Azure: remove a drive connected to a non-existent virtual machine

I just found out that I deal with - and pay for - a lot of storage due to abandoned disks from long-remote virtual machines. I managed to remove most of them, but now I am stuck in a collection that cannot be removed, since they remain attached to virtual machines that are not found anywhere.

Any ideas how to get rid of these drives might be PowerShell tricks?

+7
source share
4 answers

If I understand correctly, as soon as you delete the virtual machine, it will delete the service, but save a copy of the VHD image under Disks. Therefore, go to the Disks tab in the virtual machine and try to delete it.

If this is not the case, add a screenshot with the error message where you are trying to remove the virtual machine.

+3
source

The only way I can do this that I see is through PowerShell . I ran into the same problem and this is how I fixed it. I installed Azure PowerShell extensions and set up my subscription and then my storage account. As soon as I did this, I ran this command

 get-azuredisk | Remove-AzureDisk 

Get-azuredisk will take all disks. In my case, they all were deleted to me. If you need to do it individually, you need to get the name of the drive, and then run remove-azuredisk using the name switcher and specify the name of the drive to remove it. This fixed it for me. Hope this helps someone in the future.

+1
source

In the "new" azure portal. Select "Vault Accounts", then click "Vault Account", where the VHDs you are not using are located, click "Blocks" in the "Services" section, click "VHDS" in the "Essentials" section, find the unwanted vhd and click "Delete".

+1
source

I was unable to use the web portal (2016) to delete orphaned disks in my (classic) vault account. The answers work here, but here is a more detailed walkthrough for removing these orphaned drives using PowerShell.

Powerhell

Download and install PowerShell if you havenโ€™t already. ( Install and configure Azure PowerShell .) The initial steps from this doclink are:

  • Ensure that the Azure PowerShell module is available after installation:
    Get-Module โ€“ListAvailable

  • If the Azure PowerShell module is not listed, you may need to import it:
    Import-Module Azure

  • Log in to Azure Resource Manager:
    Login-AzureRmAccount

AzurePublishSettingsFile

  • Restore your PublishSettingsFile.
    Get-AzurePublishSettingsFile

  • Import-AzurePublishSettingsFile and specify the path to the file you just saved.
    Import-AzurePublishSettingsFile -PublishSettingsFile '<your file path>'

Show and delete drives

0
source

All Articles