Share via

Deleting a virtual network

CNI 20 Reputation points
2026-02-12T14:11:44.3866667+00:00

I'm unable to delete a virtual network with the errro attached to VM. I have no VM's and nothing tied to the virtural network i can find anywhere. Seems Azure virtual network is still attached to to an old VM which doesn't exist so can't figure out how to remove the virtual network.

error below but no VM or nic

Network Interface /subscriptions/PII/resourceGroups/FileShare/providers/Microsoft.Network/networkInterfaces/PII is used by existing resource /subscriptions/PII/resourceGroups/PII/providers/Microsoft.Compute/virtualMachines/PII. In order to delete the network interface, it must be dissociated from the resource. To learn more, see aka.ms/deletenic.

Any ideas greatly appreciated.

Azure Virtual Network
Azure Virtual Network

An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.

0 comments No comments

Answer accepted by question author

TP 157.4K Reputation points Volunteer Moderator
2026-02-13T17:44:35.6866667+00:00

Hi @CNI

Based on the error you posted, you have (or had) a Microsoft Entra Domain Services managed domain linked to the virtual network. You would need to delete the managed domain first in order to delete the virtual network. Deleting a managed domain is irreversible so you want to be certain before taking this step.

Please check to see if managed domain still exists and is needed, or if it was already deleted. If it was already deleted you will need Technical support case to have backend engineer remove the link.

Delete a Microsoft Entra Domain Services managed domain

https://docs.azure.cn/en-us/entra/identity/domain-services/delete

Please click Accept Answer and upvote if the above was helpful.

Thanks.

-TP

Was this answer helpful?

2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Ganesh Patapati 11,915 Reputation points Microsoft External Staff Moderator
    2026-02-13T08:13:07.0933333+00:00

    You might receive errors when you try to delete a virtual network in Azure. This article provides troubleshooting steps to help you resolve this problem.

    Reference docs: Failed to delete a virtual network in Azure

    Troubleshooting guidance

    1. Check whether a virtual network gateway is running in the virtual network.
    2. Check whether an application gateway is running in the virtual network.
    3. Check whether Azure container instances still exist in the virtual network.
    4. Check whether Microsoft Entra Domain Service is enabled in the virtual network.
    5. Check whether the virtual network is connected to other resource.
    6. Check whether a virtual machine is still running in the virtual network.
    7. Check whether the virtual network is stuck in migration.
    8. Check for Hidden Connections: Sometimes there might be hidden connections to your virtual network. In the Azure portal, navigate to your resource group and select Show hidden types to see if any resources are still linked to the virtual network.
    9. Confirm Network Interfaces: Since the error message points to a network interface being in use, double-check the network interfaces associated with your virtual network. You can do this in the Azure portal:
      • Go to your virtual network and check the Connected devices section.
      • If you see a network interface there, you need to delete it before you can successfully delete the virtual network.
    10. Use Azure CLI: If the above steps don't help, you can use Azure CLI commands to find and delete the problematic network interface:
      • First, get the network profile ID:
             REG_GROUP={your-resource-group}
             VNET_NAME={your-vnet-name} SUBNET_NAME={your-subnet-name}
             NetworkProfile=az network vnet subnet show -g $REG_GROUP --vnet-name $VNET_NAME --name $SUBNET_NAME -o tsv --query ipConfigurationProfiles[].id 
        

    Then, delete the network interface:

    • Then, delete the network interface:
           az network profile delete --ids $NetworkProfile --yes
      
    1. Run Diagnostics: Utilize the Azure diagnostics to check which resources are still connected to the virtual network. This may give you insights into what needs to be removed before you can delete the network.
    2. Review the Documentation: Check these resources for detailed steps and additional troubleshooting tips:

    I hope this helps you get to the bottom of the issue! If you still can't figure it out, could you let me know:

    • Have you checked for any App Services that may be linked to the virtual network?
    • Are there any other resources listed as connected under your virtual network in the Azure portal?
    • Can you please share the screenshot of the error message?
    • Has any recent change been made to your resource group or virtual network that might be affecting its status?

    Can you please update us if the action plan provided was helpful?

    Should there be any follow-up questions or concerns, please let us know and we shall try to address them.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.