microsoft / vscode-azurevirtualmachines

Azure Virtual Machines extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurevirtualmachines
MIT License
32 stars 20 forks source link

Add option to delete all associated VM resources #193

Closed nturinski closed 3 years ago

nturinski commented 3 years ago

Fixes https://github.com/microsoft/vscode-azurevirtualmachines/issues/11

Give the user the option to delete every resource that we created with the VM. That includes the disk, the network interface, the virtual network, the public ip, and the network security group. If the rg if empty that, then we delete that as well.

The prompt looks like this: image

Because I didn't want one delete failing to stop the entire action, it's wrapped in a try/catch. The output with an error looks like the following:

image

nturinski commented 3 years ago

Tested this with a VM made in the portal and it deleted the wrong nsg. I'm assuming there can be multiple nsg to a vn, so I'll have to check to make sure it's in the same resource group.

image

nturinski commented 3 years ago

Okay, actually this might be either a.) special behavior due to my subscription's rules or b.) a bug on the portal.

The nsg is created in the portal, but isn't actually linked to the VM in anyway. It's not associated with the subnet, which is what hooks up the virtual network to the network interface. It's kind of annoying, because then we don't clear the resource group, but the cleanupservice is kind of specific to us, so I'm not sure if most users will run into this. Expected: image

Actual: image

nturinski commented 3 years ago

New look! 🔥

image

image

image

image

nturinski commented 3 years ago

image

I feel like this message looks a little ugly now (especially the long running notification). Maybe keep that as "selected resources"?