Unable to delete VNet due to serviceAssociationLinks/AppServiceLink

Kien_NDM 136 Reputation points
2020-10-27T01:28:29.92+00:00

Hi,

I have deployed an Azure system including virtual networks and app services. Then, when doing virtual network deletion, I had some problems. I got the message and the subnet uses the above vnet. Then I delete the subnet and get the message that there are app services using the above subnet. In fact, there are no app services at all. When using the command below:

az network vnet subnet list --resource-group [...] --vnet-name [...]

As a result, I discovered that 1 [Microsoft.Network/virtualNetworks/subnets/serviceAssociationLinks] cannot be deleted.

Remove-AzureRmVirtualNetwork : Subnet snet-bo is in use by /subscriptions/[..id...]/resource
Groups/Disabled/providers/Microsoft.Network/virtualNetworks/vnet-drug/subnets/snet-bo/serviceAssociationLinks/AppServic
eLink and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See
aka.ms/deletesubnet.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 'bbc8987b-ffd1-420e-80c7-5913ef43b069'
At line:1 char:1

  • Remove-AzureRmVirtualNetwork -Name vnet-drug -ResourceGroupName disab ...
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : CloseError: (:) [Remove-AzureRmVirtualNetwork], NetworkCloudException
  • FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.RemoveAzureVirtualNetworkCommand

Please support, thank you.

Community Center | Not monitored
{count} votes

Accepted answer
  1. suvasara-MSFT 10,081 Reputation points Moderator
    2020-10-28T10:31:48.677+00:00

    The steps below outline a workaround you can try to resolve it.

    Workaround Steps:

    1. Create an App Service Plan with the same name as the deleted one.
    2. Create an App Service with the same name as the deleted one.
    3. Link the App Service to the VNet subnet.
    4. Disconnect the VNet from the App Service:
    5. Go to Networking > VNet Integration > Disconnect.
    6. Delete the subnet.

    Reason for the Issue:

    This issue occurs because the new VNet Integration feature (Regional VNet Integration) adds locks to subnets using a structure called a Service Association Link (SAL). These locks, managed by Azure's internal services like Microsoft.Web, occasionally fail to clean up properly. As a result, the subnet remains locked, preventing deletion or reuse.

    Next Steps:

    If the workaround does not resolve the issue, you will need to contact Azure Support for assistance.

    If you do not have a support plan, please email me with your Subscription ID and a link to this post. I will help enable a one-time free support request so that you can proceed with deleting the subnet.

    ----------

    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

    16 people found this answer helpful.

5 additional answers

Sort by: Most helpful
  1. David Zheng 0 Reputation points
    2024-01-10T00:15:20.63+00:00

    Therefore, the current problem is that the administrative privileges of serviceAssociationLinks cannot be changed by the delete command.

    We can only overwrite the original link by reconnecting the same serviceAssociationLinks type and then delete it.


Your answer

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