I have been trying for some time to delete a virtual network (classic). So far, I have not been successful using the portal; PowerShell or cli. It is the only resourceAzureVN in the only resourcegroup Default-Networking in the subscription.
I have searched the web and have tried a number of proposed solutions without success.
Here's the resource that won't go away:
PS C:\WINDOWS\system32> Get-AzureRmResource
Name : AzureVN
ResourceId : /subscriptions/
<Sub ID>.../resourceGroups/Default-Networking/providers/Microsoft.ClassicNetwork/virtualNetworks/AzureVN
ResourceName : AzureVN
ResourceType : Microsoft.ClassicNetwork/virtualNetworks
ResourceGroupName : Default-Networking
Location : westeurope
SubscriptionId :
<Sub ID>...PS C:\WINDOWS\system32> Get-AzureRmResource -Name AzureVN -ResourceType Microsoft.ClassicNetwork/virtualNetworks -ResourceGroup Default-Networking
Name : AzureVN
ResourceId : /subscriptions/
<Sub ID>.../resourceGroups/Default-Networking/providers/Microsoft.ClassicNetwork/virtualNetworks/AzureVN
ResourceName : AzureVN
ResourceType : Microsoft.ClassicNetwork/virtualNetworks
ResourceGroupName : Default-Networking
Location : westeurope
SubscriptionId :
<Sub ID>...
Properties : @{provisioningState=Succeeded; status=Created; siteId=58c18955-0af4-40b2-aab0-0fdc4eef1949;
inUse=True; addressSpace=; subnets=System.Object[]}
Note that Properties includes inUse=True. However, I am not aware of anything which could be using it.
Attempt to remove it:
PS C:\WINDOWS\system32> Remove-AzureRmResource -ResourceId "/subscriptions/
<Sub ID>.../resourceGroups/Default-Networking/providers/Microsoft.ClassicNetwork/virtualNetworks/AzureVN"
-Force
Remove-AzureRmResource : The pipeline has been stopped.
At line:1 char:1
+ Remove-AzureRmResource -ResourceId "/subscriptions/
<Sub ID>......
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureRmResource], PipelineStoppedException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet
Remove-AzureRmResource : OperationFailed : The operation '38b8fc4c71593d78bf4cd02d7b8456ca' failed: 'Cannot delete or modify virtual network while in use 'AzureVN'.'.
At line:1 char:1
+ Remove-AzureRmResource -ResourceId "/subscriptions/<Sub ID>...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureRmResource], ErrorResponseMessageException
+ FullyQualifiedErrorId : OperationFailed,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.RemoveAzureResourceCmdlet
No luck! Let's try removing the resourcegroup:
PS C:\WINDOWS\system32> Remove-AzureRmResourceGroup -Name Default-Networking -Force
Remove-AzureRmResourceGroup : Long running operation failed with status 'Conflict'.
At line:1 char:1
+ Remove-AzureRmResourceGroup -Name Default-Networking -Force
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureRmResourceGroup], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.RemoveAzureResourceGroupCmdlet
Let's try removing the VNET config:
PS C:\WINDOWS\system32> Remove-AzureVNetConfig
Remove-AzureVNetConfig : BadRequest : Cannot delete or modify virtual network while in use 'AzureVN'.
At line:1 char:1
+ Remove-AzureVNetConfig
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Remove-AzureVNetConfig], ComputeCloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.RemoveAzureVNetConfigCommand
I have also tried using Get-AzureVNetConfig; edit; Set-AzureVNetConfig, also unsuccessfully.
Any suggestions on how to make this virtual network go away?