A load balancer with a private link service or a private link service with private endpoint connections can't be deleted

This article discusses how to identify and resolve the CannotDeleteLoadBalancerWithPrivateLinkService or PrivateLinkServiceWithPrivateEndpointConnectionsCannotBeDeleted 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 one of the following error messages:

  • For the CannotDeleteLoadBalancerWithPrivateLinkService error code:

    internalErrorCode: "CannotDeleteLoadBalancerWithPrivateLinkService"

    StatusCode=BadRequest

    {

    "Cannot delete load balancer ...../providers/Microsoft.Network/loadBalancers/kubernetes-internal since it is referenced by private link service ...../providers/Microsoft.Network/privateLinkServices/test. Please delete private link service prior to deleting load balancer."

    }

  • For the PrivateLinkServiceWithPrivateEndpointConnectionsCannotBeDeleted error code:

    internalErrorCode: "PrivateLinkServiceWithPrivateEndpointConnectionsCannotBeDeleted"

    StatusCode=BadRequest

    {

    message: "Private link service ...../Microsoft.Network/privateLinkServices/test cannot be deleted since it has 1 private endpoint connection. Please delete all private endpoint connections before deleting the private link service."

    }

Cause

The private link service can't be deleted because the cluster is associated with private endpoint connections.

Solution

Make sure that the private link service isn't associated with any private endpoint connections. Delete all private endpoint connections before you delete the private link service. For more information, see Azure: How to delete a private link service that has a private endpoint connected to it?.

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.

Third-party information disclaimer

The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, about the performance or reliability of these products.