Troubleshoot the LoadBalancerInUseByVirtualMachineScaleSet or NetworkSecurityGroupInUseByVirtualMachineScaleSet error code
This article discusses how to identify and resolve the LoadBalancerInUseByVirtualMachineScaleSet
or NetworkSecurityGroupInUseByVirtualMachineScaleSet
error that occurs when you try to delete a Microsoft Azure Kubernetes Service (AKS) cluster.
Symptoms
When you try to delete an AKS cluster, you receive the following error message for LoadBalancerInUseByVirtualMachineScaleSet
:
internalErrorCode: "LoadBalancerInUseByVirtualMachineScaleSet"
StatusCode=409
{
"Cannot delete load balancer .../Microsoft.Network/loadBalancers/kubernetes since its child resources aksOutboundBackendPool, kubernetes are in use by virtual machine scale set .../Microsoft.Compute/virtualMachineScaleSets/aks-worker-test-vmss"
}
Or, you receive the following error message for NetworkSecurityGroupInUseByVirtualMachineScaleSet
:
internalErrorCode: "NetworkSecurityGroupInUseByVirtualMachineScaleSet"
StatusCode=409
{
"Cannot delete network security group .../Microsoft.Network/networkSecurityGroups/aks-agentpool since it is in use by virtual machine scale set .../Microsoft.Compute/virtualMachineScaleSets/aks-vmss"
}
Cause
You tried to delete an AKS cluster while the virtual machine scale set was still using the associated public IP address or network security group (NSG).
Solution
To fix this issue, use one of the following methods:
Remove all public IP addresses that are associated with Azure Load Balancer. For more information, see View, modify settings for, or delete a public IP address.
Dissociate the NSG that's used by the subnet. For more information, see Associate or dissociate a network security group.
Contact us for help
If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.