How to remove AKS if associated virtual machine scale set has been removed accidentally

Chen, Jerry 20 Reputation points
2024-04-18T19:34:42.81+00:00

I have a Azure Kubernetes Service. The associated resources like Virtual Machine Sale Set, Public IP Address and Load Balance has been deleted by accident. Now I want to remove this AKS, but due to lack of associate resource, I get error like

Failed to delete resource group MC_can-metrix-rg_qc-qbm-sel01_canadacentral: Deletion of resource group 'MC_can-metrix-rg_qc-qbm-sel01_canadacentral' failed as resources with identifiers 'Microsoft.Network/networkProfiles/vk-429a07e2b9d6da1629d2d584d1733eb9f423d9641fe0b4a42014d757e74ba760' could not be deleted. The provisioning state of the resource group will be rolled back. The tracking Id is '20617877-dc63-47ff-8f9a-3f12ac4e629f'. Please check audit logs for more details. (Code: ResourceGroupDeletionBlocked) Network profile /subscriptions/4bcced09-1ff1-4273-a503-47ed18b4a4b5/resourceGroups/MC_can-metrix-rg_qc-qbm-sel01_canadacentral/providers/Microsoft.Network/networkProfiles/vk-429a07e2b9d6da1629d2d584d1733eb9f423d9641fe0b4a42014d757e74ba760 is already in use with container nics fe6f8bd1-b5ef-48bd-afc9-806b34b8fe83_eth0,a72bcde7-e7bc-48ea-af62-a236ae959d74_eth0; cannot update or delete (Code: NetworkProfileAlreadyInUseWithContainerNics, Target: /subscriptions/4bcced09-1ff1-4273-a503-47ed18b4a4b5/resourceGroups/MC_can-metrix-rg_qc-qbm-sel01_canadacentral/providers/Microsoft.Network/networkProfiles/vk-429a07e2b9d6da1629d2d584d1733eb9f423d9641fe0b4a42014d757e74ba760)


Executed delete command on 'vk-429a07e2b9d6da1629d2d584d1733eb9f423d9641fe0b4a42014d757e74ba760'
Error details
vk-429a07e2b9d6da1629d2d584d1733eb9f423d9641fe0b4a42014d757e74ba760: Network profile /subscriptions/4bcced09-1ff1-4273-a503-47ed18b4a4b5/resourceGroups/MC_can-metrix-rg_qc-qbm-sel01_canadacentral/providers/Microsoft.Network/networkProfiles/vk-429a07e2b9d6da1629d2d584d1733eb9f423d9641fe0b4a42014d757e74ba760 is already in use with container nics fe6f8bd1-b5ef-48bd-afc9-806b34b8fe83_eth0,a72bcde7-e7bc-48ea-af62-a236ae959d74_eth0; cannot update or delete (Code: NetworkProfileAlreadyInUseWithContainerNics)


Could you please help me to remove this AKS service in such condition? Thanks

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,892 questions
{count} votes

1 answer

Sort by: Most helpful
  1. vipullag-MSFT 24,881 Reputation points
    2024-04-19T04:01:25.24+00:00

    Hello Chen, Jerry

    Welcome to Microsoft Q&A Platform, thanks for posting your query here.

    Based on the details shared, looks like the network profile associated with your AKS cluster is still in use by some container network interfaces (CNIs). This is preventing the deletion of the resource group that contains the AKS cluster.

    To resolve this issue, you can try the following steps:

    -Identify the CNIs that are using the network profile.
    -Delete the CNIs that are using the network profile.

    -Once all the CNIs that are using the network profile have been deleted, you should be able to delete the AKS cluster and the associated resource group.

    If the deletion of the resource group still fails, you may need to manually delete the network profile and any other associated resources. You can use the Azure portal or Azure CLI to delete these resources.
    Hope this helps.

    0 comments No comments