cannot delete resources because attached to a non exsistant VM.

David Hodkinson 96 Reputation points
2020-08-21T13:31:37.76+00:00

Attempting to stop a Linux Virtual Machine failed, deleting it appeared to succeed, but then gave an error, it showed a status of "unknown" for a while before eventually disappearing after several attempts.

Now all the associated resources cannot be deleted. For example attempting to delete the disk space gives the error below.

EdgeVM_OsDisk_1_6298dfb1abed4bf7bb50a12666fbd969: Disk EdgeVM_OsDisk_1_6298dfb1abed4bf7bb50a12666fbd969 is attached to VM /subscriptions/46fdd035-563e-48fd-920c-bf1a40166cc0/resourceGroups/IoTEdgeResources/providers/Microsoft.Compute/virtualMachines/EdgeVM. (Code: OperationNotAllowed)

The name of the VM was EdgeVM, it was deleted on the day it was created, my subscription is still being charged as active after 10 days. The resource group likewise cannot be deleted because it contains resources which cannot be deleted.

How can I remove the resources and resource group?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,015 questions
0 comments No comments
{count} votes

Accepted answer
  1. David Hodkinson 96 Reputation points
    2020-08-22T08:01:43.647+00:00

    HI murugesan,

    Thanks for the help, there does not seem to be any other disk attached, the Advisor basically says everything is OK in the resource group.

    Further investigation in PowerShell using Get-AzVM indicates that the VM exists in the subscription in Resource Group IOTEDGERESOURCES. However using Get-AzVM –ResourceGroupName “IOTEDGERESOURCES” does not show. Also the VM cannot be found using either the Name or the ResourceId. On the Disk Overview Display, the Operations, Queue Depth and Disk Bytes/secs each show an error message “Resource not found”.

    Basically the Disk and network resources properties use a VM ResourceId that is invalid. But the Billing system still sees it as an active VM and charges for it along with the associated storage and network costs.


3 additional answers

Sort by: Most helpful
  1. KarishmaTiwari-MSFT 20,772 Reputation points Microsoft Employee Moderator
    2020-08-22T00:20:46.593+00:00

    I am sorry for the inconvenience caused. Please try the following steps and let me know the results.

    Follow this document to find and delete unattached Azure managed and unmanaged disks
    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/find-unattached-disks

    When you delete a virtual machine (VM) in Azure, by default, any disks that are attached to the VM aren't deleted. This feature helps to prevent data loss due to the unintentional deletion of VMs. After a VM is deleted, you will continue to pay for unattached disks. This article above shows you how to find and delete any unattached disks and reduce unnecessary costs.

    0 comments No comments

  2. David Hodkinson 96 Reputation points
    2020-08-22T02:30:01.583+00:00

    Thanks for the prompt response. I ran both scripts (just to be sure), but no disks were located. Using Get-AzDisk the output shows the disk as still managed by the missing VM, the DiskState property shows as “Attached” and the “ManagedBy” property shows the ResourceId of the EdgeVM virtual machine.
    The EdgeVM virtual machine does not appear in the portal or using the CLI. Unfortunately it shows on the billing as running and is charged for.

    It looks like the errors on deallocating and deleting the VM prevented the attached resources from being updated.

    0 comments No comments

  3. Murugesa Pandian 86 Reputation points
    2020-08-22T05:05:40.617+00:00

    Hi @DavidHodkinsion-6353

    I suspect there might be an new disk created or attached the existing disk while provisioning the VM.

    Least effort to identify the more information on an unattached disks, please check the "Advisor recommendation" on your subscription which helps you to proceed further action on this.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.