azurevirtual-machinedisk

Can't delete VM "Error: 'Error accessing storage"


I can't delete a virtual machine, the following error appears

PS /home/azureuser> Remove-AzDisk -ResourceGroupName 'MyResourceGroupName' -DiskName 'MyDiskName' -Force
Remove-AzDisk: Long running operation failed with status 'Failed'. Additional Info:'Error accessing storage.'
ErrorCode: StorageFailure/LeaseIdMissing
ErrorMessage: Error accessing storage.
ErrorTarget: 
StartTime: 2/17/2024 7:04:52 AM
EndTime: 2/17/2024 7:04:52 AM
OperationID: 5cab0100-eb6b-4589-9eb8-acd1bc68fc30
Status: Failed

I have also tried to delete the disk associated with this virtual machine, the following error appears

PS /home/azureuser> Remove-AzVm -ResourceGroupName MyResourceGroupName -Name MyVirtualMachine -ForceDeletion $true  
Virtual machine removal operation
This cmdlet will remove the specified virtual machine. Do you want to continue?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
Remove-AzVM: Long running operation failed with status 'Failed'. Additional Info:'Error accessing storage.  Target: '/subscriptions/dcfb3602-2c06-48a1-...........289b50f476c92b8c7d1479f74df'.'
ErrorCode: StorageFailure/LeaseIdMissing
ErrorMessage: Error accessing storage.  Target: '/subscriptions/dcfb3602-2c06-48a1-b3fe-76cae848ca0a/resourceGroups/...................b8c7d1479f74df'.
ErrorTarget: 
StartTime: 2/17/2024 7:08:37 AM
EndTime: 2/17/2024 7:09:38 AM
OperationID: b29e3d22-8290-403c-92da-6edca90f0cda
Status: Failed

Could you help me solve this problem please?

Thank you.

Run this commands via PS

Remove-AzDisk -ResourceGroupName 'MyResourceGroupName' -DiskName 'MyDiskName' -Force
Remove-AzVm -ResourceGroupName MyResourceGroupName -Name MyVirtualMachine -ForceDeletion $true

I was hoping to be able to delete the damn virtual machine, but I was unsuccessful.


Solution

  • The VM cannot be deleted because the storage cannot be deleted.

    Something is stopping you from deleting the storage.

    It could be several things: