Forum Discussion
Unable to Delete Azure Virtual Network
I'm out of ideas, in my entire subscription, I have 1 x Resource Group, and 1 x Virtual Network (Classic).
I'm trying to delete the VNET so I can delete the Resource Group, problem is I am receiving this error
"This virtual network is in use and cannot be deleted. If you recently deleted resources, it might take some time to update the virtual network".
When I run Get-AzureRmResource the only entry I get is of the Virtual Network
Name : GT-Lab-VNET
ResourceId : /subscriptions/aa5ce18d-aaef-47df-8a79-6640fe0f0693/resourceGroups/GT-Lab/providers/Microsoft.ClassicNetwork/virtualNetworks/GT-Lab-VNET
ResourceName : GT-Lab-VNET
ResourceType : Microsoft.ClassicNetwork/virtualNetworks
ResourceGroupName : GT-Lab
Location : australiasoutheast
SubscriptionId : aa5ce18d-aaef-47df-8a79-6640fe0f0693
Get-AzureRmVirtualNetwork does not appear to list the VNET, possibly because it appears to be a classic resource.
I checked, in the Azure ARM Portal, there is no Address Space or Subnet configured.
I"m not sure how else I can delete the VNET.
6 Replies
- Hannel HazeleyIron Contributor
There might be some classic resource still tied to the VNet not visible in the new portal. You should be able to check the virtual network using PowerShell but the command you are using is not for classic resources.
Add-AzureAccount Get-AzureVNetSite
- Gavin TanCopper Contributor
You're right,
AddressSpacePrefixes : {10.0.0.0/24}
Location : Australia Southeast
AffinityGroup :
DnsServers : {10.0.0.5}
GatewayProfile :
GatewaySites : {}
Id : 3a659ee2-f4f8-4e4d-a448-b467ffa95ec8
InUse : True
Label :
MigrationState :
Name : Group GT-Lab GT-Lab-VNET
State : Created
Subnets : {Default}
OperationDescription : Get-AzureVNetSite
OperationId : 38c55e74-a3ec-7b20-b4aa-e5434b675eda
OperationStatus : SucceededHow do I delete/remove this?
- Hannel HazeleyIron Contributor
From you output it says VNet is in use and i see a DNS Server entry, not sure if thats the only thing using VNet.
Did you have Azure AD Domain Service on that VNet?
Do you still have access to the legacy portal manage.windowsazure.com?
If you have access you will need to clear up the VNet from there. If you don't have access you can try exporting the VNet configuration, removing the DNS configuration and then import configuration back.
Get-AzureVNetConfig -ExportToFile "c:\temp\MyAzNets.netcfg"
Edit file to remove DNS, the update configuration
Set-AzureVNetConfig -ConfigurationPath "c:\temp\MyAzNets.netcfg"