Unable to delete subnet due to service association link

Tekscape_Bryan Mohr 0 Reputation points
2025-08-04T18:39:07.64+00:00

I am unable to delete an subnet in the azure virtual network section due to a service association link

Azure Virtual Network
Azure Virtual Network

An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.

0 comments No comments

2 answers

Sort by: Most helpful
  1. VIVEK DWIVEDI 270 Reputation points Microsoft Employee
    2025-08-05T08:28:57.8+00:00

    Hi @Tekscape_Bryan Mohr ,

    Thank you for reaching out to Microsoft Q&A Platform.

    My understanding of Problem is:

    You cannot delete a subnet in an Azure Virtual Network because it is associated with a service through a Service Association Link (SAL). The Azure Portal may not always show the SAL under the subnet blade.

    Please perform the below steps and let me know if it helps.


    Possible Root Causes

    • Private Endpoint associated with the subnet.
    • Subnet Delegation to a specific Azure service.
    • Other resources (e.g., Azure Firewall, Application Gateway) using the subnet.

    Step-by-Step Resolution

    1. Identify Service Association Links via CLI

    Run the following command:

    az network vnet subnet show \
      --resource-group <ResourceGroupName> \
      --vnet-name <VNetName> \
      --name <SubnetName> \
      --query serviceAssociationLinks
    

    If the output is not empty, note the associated resource.


    1. Check for Private Endpoints

    List all Private Endpoints in the VNet:

    az network private-endpoint list \
      --resource-group <ResourceGroupName> \
      --query "[?contains(subnet.id, '<SubnetName>')]"
    

    Delete any Private Endpoint using the subnet:

    az network private-endpoint delete \
      --name <PrivateEndpointName> \
      --resource-group <ResourceGroupName>
    

    1. Check for Subnet Delegation

    If the subnet is delegated to a service, remove the delegation:

    az network vnet subnet update \
      --resource-group <ResourceGroupName> \
      --vnet-name <VNetName> \
      --name <SubnetName> \
      --remove delegations
    

    1. Verify No Other Dependencies

    Ensure no NICs, route tables, or service endpoints are linked:

    az network vnet subnet show \
      --resource-group <ResourceGroupName> \
      --vnet-name <VNetName> \
      --name <SubnetName>
    

    1. Delete the Subnet

    Once all associations are removed:

    az network vnet subnet delete \
      --resource-group <ResourceGroupName> \
      --vnet-name <VNetName> \
      --name <SubnetName>
    

    Was this answer helpful?

    0 comments No comments

  2. Divyesh Govaerdhanan 11,895 Reputation points MVP Volunteer Moderator
    2025-08-04T21:29:56.5+00:00

    Hello,

    Welcome to Microsoft Q&A,

    The issue in Azure where you're unable to delete a subnet because it has a service association link. This usually means that a resource or service (such as a private link, network security group, or service endpoint) is still associated with that subnet, preventing its deletion.

    First, you need to find out which resource is associated with the subnet. Common services that create these links include private endpoints, network security groups (NSGs), or service endpoints.

    1. Go to the Azure Portal > Virtual Network > Subnets. Try to view the details of the subnet that is not deleting.
    2. Look for any associated services or endpoints that are linked to the subnet.
    3. Private Endpoints: If there is a private endpoint, you need to remove it from the subnet.
      • Navigate to the Private Endpoints section and check if there are any resources connected to the subnet. If so, you’ll need to delete those private endpoints.
    4. Network Security Groups (NSGs): If a NSG is applied to the subnet, remove it.
      • In the Subnet section, under Network security group, you can unassociate or remove the NSG.
    5. Service Endpoints: If service endpoints are in use, go to the Service endpoints section and remove the endpoints associated with the subnet.

    If there are any virtual machines, network interfaces, or other resources still in the subnet, they could be holding the association as well. You need to:

    • Remove or migrate any resources in the subnet before attempting to delete it again.

    Please Upvote and accept the answer if it helps!!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.