Unable to delete vNet although no more resources were inside the virtual network

Shawn Yap | MACROKIOSK 1 Reputation point
2025-02-03T04:13:53.0033333+00:00

Failed to delete the vNet although there's no more connected devices. I saw that you need a Microsoft Support team to help to remove the vNet https://learn.microsoft.com/en-us/answers/questions/140197/unable-to-delete-vnet-due-to-serviceassociationlin?page=2#answers.

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.

Failed to delete virtual network ''. Error: Subnet mkwordpres-1a76e49ce8-appsubnet is in use by /subscriptions/1f813ee0-9e60-4459-81d8-5ea94b9a912d/resourceGroups/Shawn-Testing-eastasia/providers/Microsoft.Network/virtualNetworks/wordpresstest-vnet/subnets/mkwordpres-1a76e49ce8-appsubnet/serviceAssociationLinks/AppServiceLink and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet.

But I didn't have vNet integration implemented.

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.
2,628 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Vallepu Venkateswarlu 0 Reputation points Microsoft Vendor
    2025-02-03T12:26:33.9033333+00:00

    Hi Shawn Yap

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out, and I hope you are doing well.

    If VNet intigration is not associated with any app serive, but the subnet is still associated with the Service Association Link, you can use an alternate approach. Create an App Service Plan with the same name as the existing one, then create an App Service with the same name as the deleted one and link the App Service to the VNet subnet.

    Once you integrate the VNet into the App Service, use the below command to check if the application is integrated with the VNet

    Note: If the VNet is associated with any applications, such as a webapp, the Service Association Link will automatically be added to the subnet, preventing the VNet from being deleted.

    az network vnet subnet show -g $ResourceGroupName -n $SubnetName --vnet-name $VNetName
    

    Output

    enter image description here

    If the Service Association Link is attached to the subnet, make sure to remove the VNet integration and subnet delegation from the subnet

     az webapp vnet
    

    After removing the Vnet intigration in the app service, the Service Association Link has been removed from the subnet.

    enter image description here

    After removing the VNet integration and subnet delegation, I am able to delete the subnet that is associated with the.Service Association Link

    enter image description here

    Reference: Unable to delete VNet due to serviceAssociationLinks/AppServiceLink - Microsoft Q&A

    Hope this helps!


    If the above is unclear and/or you are unsure about something, add a comment below.

    Please don’t forget to close the thread by clicking “Accept the answer” wherever the information provided helps you, as this can be beneficial to other community members.


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.