Hello @Tarek Nabil,
Thank you for reaching out on the Microsoft Q&A forum.
I understand that you attempted to delete all Azure resources created as part of a Cloud Shell environment integrated with your Virtual Network (VNet). However, when trying to remove one of the subnets, you encountered "NetworkProfileAlreadyInUseWithContainerNics" error.
The network profile (e.g., aci-networkProfile-australiaeast) cannot be deleted because Azure still detects container network interfaces (container NICs) associated with it — even though the corresponding container instances or NICs were already deleted.
This behaviour indicates orphaned metadata in the Azure Resource Manager (ARM) backend. Essentially, the system still believes these NICs exist, even though they are no longer visible to the user.
This scenario typically occurs when:
- Azure Cloud Shell or Azure Container Instances (ACI) were deployed using a delegated subnet along with an associated Network Profile (a hidden dependency created for container networking).
- After deleting the ACI or Cloud Shell container, the container NICs linked to the network profile sometimes remain in the backend.
- The Network Profile remains “in use,” preventing the deletion of both the profile itself and the subnet it is attached to.
This is a known behaviour in Cloud Shell-managed VNets or ACI deployments when resource cleanup is incomplete. (Microsoft Docs – Cannot delete VNet/Subnet used by ACI)
Normally, you can check for hidden container NICs using Azure CLI
1.Check and Delete Hidden Container NICs via Azure CLI
List all container NICs in your subscription/resource group:
az resource list --resource-type "Microsoft.Network/containerNetworkInterfaces" --output table
If any entries exist, delete them explicitly:
az resource delete --ids <resource-id>
After removing any hidden container NICs, retry deleting the network profile and subnet:
az network profile delete --name <profile-name> --resource-group <resource-group-name>
Have you already tried this step to ensure there are no hidden NICs remaining?
- If you haven’t checked for hidden container NICs, please try the above commands and let us know the results.
- If you’ve already done this and the NICs still do not appear, it confirms that the resources are orphaned in the Azure backend. In that case we need to contact backend team for support.
Kindly let us know if the above helps or else we will reach out to backend team for support.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.