Can't delete old Azure VM, fails on non-existent key vault error.

Andy Carter 20 Reputation points

I need to delete an old Azure VM which has been replaced by a new native app service.

Tried everything but it just won't delete, keeps failing with this error.

Any wise owl out there got a nugget of knowledge for me?

TIA, Andy

An error occurred while updating associated resources for virtual machine 'SN-Server1'. To delete the virtual machine without updating associated resources first, try again without updating any associated resource deletion states. Error: 'Key Vault does not exist.'

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

Accepted answer
  1. Anveshreddy Nimmala 3,200 Reputation points Microsoft Vendor

    Hello Andy Carter,

    Welcome to microsoft Q&A, Thankyou for posting your query here.

    Check if the Key Vault exists in the Azure portal. If it does not exist, you can create a new Key Vault with the same name or update the virtual machine to use a different Key Vault.

    If the Key Vault exists, check if the virtual machine is using the correct Key Vault name. You can update the virtual machine to use the correct Key Vault name.

    In Azure portal and select "Virtual Machines" from the menu.

    Choose 'SN-Server1' from the list of virtual machines.

    In the virtual machine's settings, look for "Identity" or "Secrets".

    If the virtual machine is referencing the wrong Key Vault, update it to use msvsaz2m07klwbjn.

    If you are still unable to delete the virtual machine, you can try deleting it without updating any associated resource deletion states.

    Click on "Delete" and when prompted, select the option to "Delete without deleting any associated resources"

    Use Azure CLI to delete the VM attached. Force delete allows you to forcefully delete your virtual machine, reducing delete latency and immediately freeing up attached resources.

    For VMs that don't require graceful shutdown, Force Delete will delete the VM as fast as possible while relieving the logical resources from the VM, bypassing the graceful shutdown and some of the cleanup operations.

    Force Delete won't immediately free the MAC address associated with a VM, as this is a physical resource that may take up to 10 min to free. If you need to immediately reuse the MAC address on a new VM, Force Delete isn't recommended.

    Force delete should only be used when you aren't intending to reuse virtual hard disks. You can use force delete through Portal, CLI, PowerShell, and REST API.

    az vm delete --resource-group myResourceGroup --name myVM --force-deletion none

    Hope this helps you.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful