Forum Discussion
Unable to Delete Azure Virtual Network
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
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 : Succeeded
How do I delete/remove this?
- Hannel HazeleyFeb 03, 2018Iron 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"
- Gavin TanFeb 03, 2018Copper Contributor
As far as I am aware, every single thing has been deleted from the subscription leaving this VNET.
I have done the network config export, removed the DNS, and that was successful however I am still prevented from deleting the VNET.
<?xml version="1.0" encoding="utf-8"?>
<NetworkConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/ServiceHosting/2011/07/NetworkConfiguration">
<VirtualNetworkConfiguration>
<Dns />
<VirtualNetworkSites>
<VirtualNetworkSite name="Group GT-Lab GT-Lab-VNET" Location="Australia Southeast">
<AddressSpace>
<AddressPrefix>10.0.0.0/24</AddressPrefix>
</AddressSpace>
<Subnets>
<Subnet name="Default">
<AddressPrefix>10.0.0.0/24</AddressPrefix>
</Subnet>
</Subnets>
</VirtualNetworkSite>
</VirtualNetworkSites>
</VirtualNetworkConfiguration>
</NetworkConfiguration>I wished I still had access to the ASM Portal, right now I keep getting redirected to the ARM Portal.
Remove-AzureVNetConfig : BadRequest : Cannot delete or modify virtual network while in use 'Group GT-Lab GT-Lab-VNET'.
At line:1 char:1
+ Remove-AzureVNetConfig
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureVNetConfig], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.RemoveAzureVNetConfigCommandWorst thing is that I am unable to get support for this because its an MSDN Subcription.
- Hannel HazeleyFeb 04, 2018Iron Contributor
At this point it could be multiple things, below is an article that goes over a few things to check.
https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-troubleshoot-cannot-delete-vnet
Most times its the Azure AD Domain Service, people tend to forget about it because it is not really setup on the virtual network.