Delete VM with all associated resources
Deleting a VM is a lot of click work. I have to manually delete the associated Network interface, Network security group, Public IP address. And then, from the associated storage account, I have to drill down into the VHD container in the right Blob to delete the associated .vhd and .status files.
Also, I have to do it in the right order, because there are dependencies between the various objects. If not, it fails, and I get a big fat pink error.
Also, the overview list does not refresh after the 'success' notification is posted, so I sit there guessing which of the resources I already deleted and which I didn't.
It all feels boring, not fun and tedious!
This is still coming. The work is being completed now and we will be able to expose it in a few months.
I agree with other here . . .
"As Tom Callahan wrote over a year ago, "Please provide an option to delete all associated objects related to the Virtual Machine as the default, which can be disabled if need be. More often than not I would guess people want to delete all objects associated, instead of having to go item by item."
The current situation is ridiculous"
I've created a quick shell script with CLI that deletes a vm and dependencies except data disks (by design, but can be added). https://github.com/riedwaab/delvm/blob/master/delvm.sh
I want to deploy identical 100 Virtual Machines using Terraform. I can not create 100 resource groups. I want a way such that I can delete a Virtual Machine and it will take care of deleting all the associated resources for that particular virtual machine. Something like "delete on terminate" for all the associated resources (i.e. storage account, IP address, nsg etc) for the single VM I am deleting.
very troublesome if we delete VM need manually choose and delete related component.
stella gord commented
Azure portal team (Admin, Microsoft Azure) responded · Jul 20, 2015
What up with this :
Hi, Joost. Thanks for the feedback. We can definitely look into offering a way to delete multiple resources at the same time. For the time being, if you organize your related resources into resource groups, you can delete the entire resource group with a few clicks, which should help.
David Sanftenberg commented
Microsoft is very short on the polish side of things. You guys need to concentrate on the UX of the infra you're creating, take the entire lifecycle into account. It's kind of ridiculous that we need to write custom powershell scripts just to make sure VMs aren't leaving orphaned disks and nics lying around when we delete them.
Also i would say before deleting the VM, there was a confirmation to type the resource name for deleting. In the same screen they can list the associated resources and keep the check box to select and delete those as well. It helps.
Travis Fremming commented
We are using a customized solution from Rackspace that does this. I no longer want to use this solution, I want to use the Azure Portal. The RS solution deletes the VM, Nic Card and the DNS record of the VM. Talking to a MSFT rep yesterday your old portal did this? I agree with the comments below deleting an entire resource group is not a viable solution. I have all our Dev/Test resources in one resource group, so deleting the entire resource group makes zero sense. Even if I separated it out, it is not time friendly.
Rennie Petersen commented
As Tom Callahan wrote over a year ago, "Please provide an option to delete all associated objects related to the Virtual Machine as the default, which can be disabled if need be. More often than not I would guess people want to delete all objects associated, instead of having to go item by item."
The current situation is ridiculous.
wov.. so how will this work out when i have a custom image in a resource group.. You have to have the vm in the same storage account as the image.. which means they have to be in the same resource group. deleting the resource group will also delete custom image.
Hi Azure portal team (Admin, Microsoft Azure),
Resource groups are being used for other different purposes by customers, this feature is available in the old portal for deleting VHD's. why are key features like this one and others like "Custom Images mgmt in gallery" missed out on a very fashionably promoted platform by Microsoft. doesn't really make sense. Customers are building their own custom scripts to address all these short-comes, which is inconvenient and time wasted which culd have otherwise been spent on hosting more workloads on azure, and especially when Microsoft's trying to compete with a gigantic player like AWS.
Anyhoo, is there a date set on this.?
Thiago Horta commented
I am without resources where to seek the correct help.
See, mistakenly deleted the cloud, which made delete a super important cloud for business and generates a great loss. The cloud was excluded along with VM and your OS Disk. Sorry, however it is unbelievable that does not have a way to perform the rollback operation, okay it is not possible for the application, however Microsoft should have a general backup application, understand that it is more work, however would like and I ask you to please contact me to help me. In my case, I need only 1 file present in this VM, do not need the VM operating again. In terms of technology we all know that it is quite possible to accomplish. Please, contact me!
Can anyone help me with a Powershell script that does the same...
We should definately have an option to delete associated resources when the respective vm is deleted. Creating new resource group for each vm is not feasible solution. Do we have any update on this?
once i have deleted a resource group containing VMs , is there any way i can get the resource group and VMs back, when backup is even not taken?
ok, this is ridiculous. I'm guessing I can do it PowerShell, but why?? 2nd request would be a tree node/filter that shows all orphaned resources and way to remove all of them.
Unfortunately, the resource group deletion does not work because 90% of customers have many other VMs under the same resource group.
Tzur Turkenitz commented
Microsoft, could you please provide an update?
My mouse is wearing down from all the clicks I have to make when I delete VMs.
Thomas Conté commented
You could also use tags to identify all resources associated to a specific VM, and then use this tag to delete the VM and related resources. But it would be great to have an API to e.g. enumerate all resources related to a VM so they can be deleted.
any more news on this, I can delete the public ips and nics but not the associated vhd files. Which SDK do I use?