Trying to delete a Virtual Network in Azure
Note this removes all Virtual Networks from your active Azure Subscription
Remove-AzureVNetConfig : BadRequest : Cannot delete or modify virtual network while in use 'xxxxx'.
I do not have Virtual Machines as I removed them all. But then I noticed the VNetwork has a Gateway assigned to it.
So remove the gateway before removing the VNetwork.
|Delete the Gateway|
By the way, the Powershell command for deleting a VNet Gateway:
Remove-AzureVNetGateway -VNetName "SPAutoVNet"