Cannot Delete Virtual Network Gateway in Azure - 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?

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:
Go to Overview tab and click on the gateway icon shown with a green check mark in the right pane.
On the gateway detail screen click the delete button in left pane:
Click Yes on the warning message which says Are you sure you want to delete this gateway?
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.
Now just click on the delete button to get rid of the virtual network in entirety.

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.

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.

Related

Azure WVD Hostpool - Virtual Network displaying "None available"

I keep encountering an irritating blocker when attempting to create a Host Pool for my project's Windows Virtual Desktop (WVD) in Azure and I'm at my wits end figuring out what could be causing this issue.
My existing resource group contains the following resources (all fully setup and configured):
A VNet
Security Group
Key Vault
All of the above resources can be confirmed via the Portal, Azure Powershell and Az CLI.
However, when attempting to create the Host Pool for the WVD which is the next resource we're seeking to provision manually through the Portal, I get prompted to Add virtual machines and upon selecting the option to add a virtual machine, I'm prompted to complete the Network and security configuration. However, the Virtual network dropdown isn't populated with any list, rather showing as "None available".
The Virtual Network definitely exists and I can't understand why the dropdown list continues to be empty. I've deleted and recreated the entire resource group on a number of occasions but all to no avail. Any advice or suggestions on how to get past this issue would be much appreciated.
Thank you for updating your solution. I face exact same problem and follow your guidance and find that my VNET is in a different region v.s. the host pool.
Originally I can not find the drop down item in the virtual network either, my workaround is to create a VNET in the same region on host pool and now I can select it.
Managed to establish what the issue was. It was the selected "Virtual machine location" value that was not allowing me to see the target VNet in the "Virtual network" dropdown list.
By default, Azure was populating the Virtual machine location field with the name of a region where my VNets didn't exist. Once I'd spotted this and switched it to the correct Region, the Virtual network dropdown list further below was populated as expected.

Azure APIM VNet Stuck

I've created an instance of APIM. After placing it in a Virtual Network, when I click on API's It just sits there spinning. If I click add, and attempt to add a new API I get the following error message no matter what "Name" I give it. "One or more fields contain incorrect values:
Name is already in use"
There are no API's so this should not occur at all, for the sake if testing I tried several random strings and it's always the same response.
Any thoughts?
Please refer the important section in the enable vnet connection article.
https://learn.microsoft.com/en-us/azure/api-management/api-management-using-with-vnet#-enable-vnet-connection

Failed to delete VNet in Azure after checking the connections and connected devices

I have an Azure VNet and it was used for Azure Environment Service. Since it is no longer used, I deleted all relative resources. But when I delete this VNet, there is an error :
Failed to delete virtual network 'name-vnet'. Error: Subnet legoexttest-subnet is in use by /subscriptions/XXX/providers/Microsoft.Web/hostingEnvironments/name and cannot be deleted.
I've found this Troubleshooting: Failed to delete a virtual network document.
I checked the issues one by one and still didn't solve my problem.
I'm sure that there is no connected device or service endpoint in my VNet. But there is an Address Space and a Subnet in it. I also can't delete either of them because the same error :
Failed to delete subnet 'name-subnet'. Error: Subnet legoexttest-subnet is in use by /subscriptions/XXX/providers/Microsoft.Web/hostingEnvironments/name and cannot be deleted.
I just don't know what is /providers/Microsoft.Web and how to delete or enable this use in order to delete my VNet in Azure.
Go to https://resources.azure.com
Select the correct subscription and navigate down the hierarchy to find your VNET and look through the resource for dependencies. Remove those dependencies manually and try delete your VNET again.
From the error message you have it seems like you have a WebApp or FunctionsApp (i.e. An App Service Plan) that is dependant on the VNET, possibly linked via a service endpoint, have you double checked.
Lastly, it can take some time for Azure to decommission an App Service plan, if you were trying to delete immediately, try again after a couple of hours.

Azure VNET location is not shown; cannot create new VM in existing VNET

I created a VNET a few days ago. Then added there two virtual machines and everything was running smoothly until today when I had to add a third VM.
I did everything exactly same like previous two times but creation of new VM failed and I had to start from the beginning. Unfortunately when I got to a third step (where VNET has to be specified) Azure UI told me that there are no VNETs available in selected region (West Europe):
But here is what I see in "All resources" list:
And here is properties of "frontend-vnet":
By some reason "Location" is not shown there (which is a clear bug).
I guess, my VNET got corrupted but I don't see the way how to fix it. Did somebody encounter same situation? Does somebody know how to fix it?

Azure - Redeploy existing windows VMs in Azure to connect to Virtual Network

I need to connect my existing VMs to new Virtual Network. Documentations says you have to redeploy them, but I could not find any source which says how to redeploy an existing VM.
Thanks,
Prasad
Create an image of your VM:
Select your VM
Hit Capture on the bottom bar. Give it a name and make sure it completes successfully
Navigate to Cloud Service >> Select the CS >> Delete >> Chose CS and it's deployments
Review the list of VMs and disks that are going to be deleted
Delete
Redeploy the VM from Image:
Click New >> Compute >> Virtual Machine >> From Gallery
On the right side >> Click My Images >> Select your captured image
Complete the wizard. Make sure to select the correct Virtual Network.
Pre-requisites:
Virtual Network is in the same location as the captured Image. Otherwise you will have to move the VHD to a storage located in the same data center as the new Virtual Network. Virtual Network will not show up on the list if this pre-requisite is not met.
If you intend to use the captured image to deploy several other VMs with the same content you will have to run sysprep (windows) or deprovision waagent (linux) before capturing. Otherwise you will have connectivity problems since all the vms will share the same unique Ids.
More Info:
How to Capture a Windows Virtual Machine to Use as a Template:
http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-capture-image-windows-server/
How to Capture a Linux Virtual Machine to Use as a Template: http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-capture-image/

Resources