Solvedazure docs Error deleting a network profile

Hello,

I have an issue deleting a network profile, created by a container deployment.
I've tried the deletion with the cli and in the azure portal.

The deployment and how to delete a network-profile, is mentioned here:
https://docs.microsoft.com/de-de/azure/container-instances/container-instances-vnet

When I try to delete the network profile, I keep getting the message:

C:\Users\clangner>az network profile delete --id /subscriptions/abf141a1-3f7b-4c54-8573-8031188e6aab/resourceGroups/dx_test/providers/Microsoft.Network/networkProfiles/aci-network-profile-dx_container-dx4-net -y

Network profile /subscriptions/abf141a1-3f7b-4c54-8573-8031188e6aab/resourceGroups/dx_test/providers/Microsoft.Network/networkProfiles/aci-network-profile-dx_container-dx4-net is already in use with container nics a86721e0-3ca4-431a-9cde-e85fa9ac1ea8_eth0; cannot update or delete

I understand, that there is a container nic that is using the network profile.
The problem is, there is no exisiting container anymore in my exisiting resource groups.
I've deleted all of them with the following command:

az container delete -g dx_test -n dx4-csb

Do you know, why I can't delete the network profile?
Why is there a network interface from a non-exisiting container?
Is there a possibility to delete this network interface manuellay?

When there are any questions, don't hesitate to ask me.
Thanks in advance.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

47 Answers

✔️Accepted Answer

The workaround that worked for me is to update the containerNetworkInterfaceConfigurations property in Network profile properties to an empty list:

# Get network profile ID
NETWORK_PROFILE_ID=$(az network profile list --resource-group <reource-group-name> --query [0].id --output tsv)

az resource update --ids $NETWORK_PROFILE_ID --set properties.containerNetworkInterfaceConfigurations=[]

And then I was able to delete the network profile and subsequently the subnet.

Other Answers:

The workaround that worked for me is to update the containerNetworkInterfaceConfigurations property in Network profile properties to an empty list:

# Get network profile ID
NETWORK_PROFILE_ID=$(az network profile list --resource-group <reource-group-name> --query [0].id --output tsv)

az resource update --ids $NETWORK_PROFILE_ID --set properties.containerNetworkInterfaceConfigurations=[]

And then I was able to delete the network profile and subsequently the subnet.

This worked for me and saved me the hassle of raising a support case, thanks!!!

I can confirm this issue is still very much valid. az network nic list -g <name> shows me empty result.

This is still not fixed. Once the container group is deleted, the network profile is still left over. After running az network profile delete --id $NETWORK_PROFILE_ID -y still repeatedly get these errors:

Network profile /subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RG/providers/Microsoft.Network/networkProfiles/aci-network-profile-$RG-vnet is already in use with container nics a76d6805-228d-485c-a40b-27df9aa2b446_eth0; cannot update or delete

Also getting this error:
Failed to delete resource group $RG: Deletion of resource group '$RG' failed as resources with identifiers 'Microsoft.Network/networkProfiles/aci-network-profile-$RG-vnet,Microsoft.Network/virtualNetworks/$RG-vnet' could not be deleted. The provisioning state of the resource group will be rolled back. The tracking Id is 'e2ecf6cd-7b8e-412e-b292-ccfec9030830'. Please check audit logs for more details. (Code: ResourceGroupDeletionBlocked) Network profile /subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.Network/networkProfiles/aci-network-profile-$RG-vnet is already in use with container nics a76d6805-228d-485c-a40b-27df9aa2b446_eth0; cannot update or delete (Code: NetworkProfileAlreadyInUseWithContainerNics, Target: /subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.Network/networkProfiles/aci-network-profile-$RG-vnet) Subnet ContainerSubnet is in use by /subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.Network/networkProfiles/aci-network-profile-$RG-vnet/containerNetworkInterfaceConfigurations/eth0/ipConfigurations/ipconfigprofile and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet. (Code: InUseSubnetCannotBeDeleted, Target: /subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.Network/virtualNetworks/$RG-vnet)

Have had multiple back and forth with Azure support on this and latest update says that the "container team" needs to do something on the backend. Was able to finally delete a single vnet after the Azure team was able to delete container delegations on the backend.

Worst part is that this ticket has been closed and Azure states that the issue has been mitigated, yet still we need to open individual support tickets for each resource group.

If anyone has a root cause or instructions on how to remove these vnets without requiring Azure support, that would be really appreciated.

Related Issues:

25
azure docs Error deleting a network profile
The workaround that worked for me is to update the containerNetworkInterfaceConfigurations property ...
11
azure docs RBAC failing on AKS
I found that: Was enough in my case Thank you very much I walked through the steps here (https://doc...
9
azure docs can't download a file, thinks it's a directory
Seeing the same exact issue as @Plasma azcopy copy 'https://asdf.blob.core.windows.net/asdf/filename...