Cannot Delete Virtual Network Gateway in Azure

核能气质少年 提交于 2019-12-07 05:19:11

问题


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?


回答1:


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.

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.

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

  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.

  1. Now just click on the delete button to get rid of the virtual network in entirety.



回答2:


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.




回答3:


Have you tried to use the PowerShell cmdlet to do this?

Remove-AzureVNetGateway -VNetName

You can put -Verbose on there if you're still hitting an error and maybe get a better error response.

-matt



来源:https://stackoverflow.com/questions/23205488/cannot-delete-virtual-network-gateway-in-azure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!