Cannot delete a subnet due to AppServicelink and the previous App service plan has been deleted

Tobias DevOps 5 Reputation points
2024-01-17T10:59:48.7566667+00:00

This issue bugged me for a year. When I try to delete a this Vnet. I got this error: Failed to delete virtual network ''. Error: Subnet ads-stg-snet-ads-appservice is in use by /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ads-rg/providers/Microsoft.Network/virtualNetworks/ads-stg-vnet-ads/subnets/ads-stg-snet-ads-appservice/serviceAssociationLinks/AppServiceLink and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet. I could not revover because the previous App service plan has been deleted. My account is my company's capped account and cannot be upgraded to have a support plan. And the used IP range block my further development in this tenant. Is there any walk-around to this problem. Very appreciated for your help.

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,469 questions
{count} vote

2 answers

Sort by: Most helpful
  1. ChaitanyaNaykodi-MSFT 26,121 Reputation points Microsoft Employee
    2024-02-03T02:55:26.98+00:00

    @Tobias DevOps

    Thank you for reaching out and apologies for the delayed response here.

    The suggested workaround in this case is as mentioned here.

    Workaround:

    1. Create App Service Plan with the same name as the deleted one
    2. Create App Service with the same name as the deleted one
    3. Link App Service with the VNET subnet
    4. Disconnect VNet from App Service -> Networking -> VNet integration -> Disconnect
    5. Delete subnet

    Reason for this Error:
    The new VNET integration feature (Regional Vnet Integration) must set locks on subnets in the Network Resource Provider, we set these locks by putting a structure called a Service Association Link onto the Subnet, which is a privileged operation that only Microsoft.Web and some other internal Azure services have access to, this ends up being odd cases where these locks don't get cleaned up. The result is that the customer will have a subnet that cannot be deleted or used because a Service Association Link still exists on the subnet. If you have forgotten the name, you can use Get-AzDeletedWebApp (Az.Websites) | Microsoft Learn to retrieve the app name. For getting the details of the app service plan, you can go to Resource explorer from your portal. After going, you can go to the subnet details and you can get the details of previous app service plan in which previous integrated web app is hosted as shown below.

    118013-image005.jpg If above work around does not help then a support request will be required here to remove the subnet delegation and to delete the Virtual Network.

    Could you please send an email to azcommunity@microsoft.com with the details below so that I can enable a one-time free support ticket for you in this case.

    Subject : Attn Chaitanya

    Thread URL: Link to this thread.

    Subscription ID

    Please let me know once you have done the same.

    Hope this helps! Please let me know if you have any additional questions. Thank you! 


    I hope this has been helpful! Your feedback is important so please take a moment to accept answers. If you still have questions, please let us know what is needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A! User's image

    1 person found this answer helpful.
    0 comments No comments

  2. Jay Brummels 0 Reputation points
    2024-08-14T18:20:14.2366667+00:00

    I added a proposed solution below. I have had this problem multiple times and the backend team was engaged via a support request to resolve.

    https://feedback.azure.com/d365community/idea/fce5fa14-455a-ef11-b4ac-000d3a7b1c7e

    0 comments No comments

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.