Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Delete Virtual Network Gateway in Azure

I am attempting to delete a virtual network in Azure. When I use the web interface to delete it, it says

Virtual network 'MyVirtualNetwork' is in use and cannot be deleted. If you recently deleted resources, it might take some time to update the virtual network.

Of course, I didn't recently delete resources and there are no VMs using the network. I followed this StackOverflow post here which says that in order to delete a Virtual Network, you must first delete the Virtual Network Gateway.

So, as per the instructions "To delete a virtual network gateway" on MSDN here, I click through the Azure web interface like this:

Virtual Network > *MyVirtualNetwork* > Dashboard > Delete Gateway

And I get this:

Failed to delete the gateway for virtual network 'OneCoreWikiVnet'.

Azure offers no further explanation or other details.

How do I delete this virtual network gateway?

like image 893
user3557943 Avatar asked Apr 21 '14 20:04

user3557943


2 Answers

Yes. As you know it correctly that you have to delete all the subnets shown under settings section before you are able to delete the virtual network itself as shown in the snapshot below. As you can see that I've got two subnets namely GatewaySubnet and Subnet 1.

enter image description here

You can delete all the subnets except GatewaySubnet using delete option shown under ... menu at the end of every row.

If you try deleting the GatewaySubnet from the same ... option it gives you an error saying:

The gateway subnet cannot be deleted.

Now the question remains as to how to delete the GatewaySubnet. Here is the step by step process to accomplish the same:

  1. Go to Overview tab and click on the gateway icon shown with a green check mark in the right pane.

enter image description here

  1. On the gateway detail screen click the delete button in left pane:

enter image description here

  1. Click Yes on the warning message which says Are you sure you want to delete this gateway?

  2. This will result in deletion of the GatewaySubnet. You can observe now on the overview tab that icon of Gateway has turned grey and its brief description reads Click here to create a gateway.

enter image description here

  1. Now just click on the delete button to get rid of the virtual network in entirety.
like image 163
RBT Avatar answered Sep 18 '22 04:09

RBT


The azure object hierarchy is as follows.

Virtual Network --> Virtual Network Gateway --> Connections

To delete, you should delete from bottom up (or right to left in this case). Essentially, to delete a VNET gateway you need to ensure that any connection on the gateway is removed first.

like image 42
KPS Avatar answered Sep 20 '22 04:09

KPS