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
Remove all public IP addresses that are associated with the subnet, and remove the NSG that's used by the subnet. For more information, see Delete the front-end IP configuration used by the virtual machine scale set.
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.