Unable to delete subnet because of orphaned SAL

Prakhar Parimal 56 Reputation points
2026-08-10T19:47:51.4166667+00:00

I'm trying to delete an azure subnet but getting error "Failed to save subnet 'agent-subnet'. Error: 'Subnet /subscriptions/1551aa63-0970-481e-9119-39af8a03628b/resourceGroups/ZNE-LA-N-01-AI-RSG/providers/Microsoft.Network/virtualNetworks/agent-vnet-test/subnets/agent-subnet requires any of the following delegation(s) [Microsoft.App/environments] to reference service association link /subscriptions/1551aa63-0970-481e-9119-39af8a03628b/resourceGroups/ZNE-LA-N-01-AI-RSG/providers/Microsoft.Network/virtualNetworks/agent-vnet-test/subnets/agent-subnet/serviceAssociationLinks/legionservicelink. Those delegations are either missing or getting deleted from subnet."

since allowDelete: False , I'm unable to delete it because of orphaned Service Association Link. How can I do force cleanup

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

Answer accepted by question author
Allan Solomon Mejia 7,590 Reputation points
2026-08-10T21:42:28.51+00:00

Hello @Prakhar Parimal

The error indicates that the subnet still contains a service-managed Service Association Link (SAL):

serviceAssociationLinks/legionservicelink

linkedResourceType: Microsoft.App/environments

allowDelete: false

This is typically created by an Azure Container Apps/Foundry managed environment. Because allowDelete is false, you shouldn't try to force-delete the SAL or remove the Microsoft.App/environments delegation first.

Start by confirming whether any managed environment still exists:

az containerapp env list -o table

and inspect the subnet:

az network vnet subnet show \
  --resource-group ZNE-LA-N-01-AI-RSG \
  --vnet-name agent-vnet-test \
  --name agent-subnet \
  --query "{delegations:delegations,serviceAssociationLinks:serviceAssociationLinks}"

If no Microsoft.App/environments resource remains but legionservicelink is still present, then this is an orphaned SAL.

There have been multiple recent cases with exactly this Microsoft.App/environments/legionservicelink condition. Unlike the Microsoft.Web App Service SAL, there isn't a documented customer-side purge operation for this particular Microsoft.App SAL; persistent cases have required provider/backend cleanup.

So I would not use the commonly suggested: Microsoft.Web/.../purgeUnusedVirtualNetworkIntegration command here. That's intended for App Service (Microsoft.Web) VNet integration and doesn't match your Microsoft.App/environments SAL.

If the associated environment was only recently deleted, allow some time for asynchronous cleanup and retry. If the SAL persists, this needs Microsoft intervention.

Please "Accept the Answer" if this information helped you. This will help us and others in the community as well.

Was this answer helpful?

1 person found this answer helpful.
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.