Share via

Cannot delete VNet because of orphaned serviceAssociationLink 'legionservicelink'

Brian Denicola 20 Reputation points Microsoft Employee
2026-04-23T17:27:53.48+00:00

Unable to delete virtual network 'my-network' (resource group core_rg). Deletion fails because subnet 'agents' contains a lingering serviceAssociationLink 'legionservicelink' with property allowDelete: false. The service that created the link (Microsoft Foundry) was deleted and purged, but the serviceAssociationLink remains and blocks subnet/VNet deletion. Attempts to remove the link via Azure CLI/PowerShell (updating subnet to clear serviceAssociationLinks) have failed. Request Microsoft support assistance to remove the orphaned service association link so the subnet and VNet can be delete.

Tried all suggestions via Copilot already... such as: az network vnet subnet update \

 --resource-group core_rg \

 --vnet-name  my-network \

 --name agents \

 --remove serviceEndpoints

Please don't ask for me to try again. I am only creating this here because the internal support plan will not allow opening SevB/C tickets any longer.

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.


Answer accepted by question author

  1. Rakesh Mishra 8,420 Reputation points Microsoft External Staff Moderator
    2026-04-23T23:56:00.3633333+00:00

    Hi Brian, please find the summary of our discussion and resolution over Teams.

    Issue: The underlying container app and foundry tool was deleted but the subnets became orphaned. And subneta were not even when we tried below commands as well.

    1. Try to force backend purge using the Azure REST API for orphaned legionservicelink associations. You can trigger this from the Azure Cloud Shell:
         az rest --method POST \
           --uri "/subscriptions/<SUBSCRIPTION-ID>/providers/Microsoft.Web/locations/<LOCATION>/purgeUnusedVirtualNetworkIntegration?api-version=2024-04-01" \
           --body "{'subnetResourceId': '/subscriptions/<SUBSCRIPTION-ID>/resourceGroups/core_rg/providers/Microsoft.Network/virtualNetworks/my-network/subnets/agents'}"
      
    2. After running the above command, run the command below to delete the subnet:
         az network vnet subnet delete --resource-group xxx-rg --vnet-name xxxVnet --name xxxSubnet
      

    Cause: There were serviceAssociationLinks which were lingering in backend which were blocking the subnet deletion.

    Resolution: With the help of backend team, we purged the serviceAssociationLinks and you were able to delete the subnets after that.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.