How can I delete the Virtual Machine

shiva patpi 13,256 Reputation points Microsoft Employee
2024-11-14T01:07:10.0566667+00:00

Not able to delete my Virtual machine either by using powershell or by using azure portal or cli please help me out

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
8,134 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,030 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Lijitha B 510 Reputation points Microsoft Vendor
    2024-11-14T02:28:28.7166667+00:00

    Hi shiva patpi,
    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    Are you encountering any error messages while deleting the virtual machine using Azure, PowerShell, or the CLI? This will help in understanding and troubleshooting the issue.

    I understand that you are not able to delete Virtual machine. Please note that depending on how you delete the VM, it may only remove the VM resource itself and not associated networking or disk resources. You can modify the default settings to control which resources are deleted along with the VM.

    To delete the virtual machine in Azure portal, follow these steps:

    1. Open the Azure portal.
    2. Navigate to your virtual machine.
    3. On the Overview page, select Delete.
    4. In the Delete virtual machine pane, select the checkbox for Apply force delete.
    5. Select Ok.

    To delete the virtual machine using PowerShell and CLI and Azure portal follow the below link: Force Delete for VMs

    For additional information follow: Delete a VM and attached resources

    If the answer is helpful, please click "Accept Answer" and "Upvote it."

    If you have any further queries, do let us know.

    0 comments No comments

  2. Nandan Hegde 32,991 Reputation points MVP
    2024-11-18T07:34:00.3866667+00:00

    Can you please specify the error you are getting when trying to delete it?

    Via Powershell, you can try : you can use the Remove-AzVm cmdlet with the -ForceDeletion parameter set to $true

    Below MSFt doc link provides all details via Portal or CLI or Powershell :

    https://learn.microsoft.com/en-us/azure/virtual-machines/delete?tabs=portal2%2Ccli3%2Cpowershell4%2Cportal5#force-delete-for-vms

    0 comments No comments

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.