Not able to delete the Subnet

Deepak Bhardwaj 61 Reputation points
2022-09-14T08:14:21.5+00:00

Hi,

Getting below error while deleting the VNET.

Failed to delete virtual network 'Solution_Unit-vnet'. Error: Subnet default is in use by /subscriptions/7890e344-be6a-46e3-b94c-70a01769770c/resourceGroups/Solution_Unit/providers/Microsoft.Network/virtualNetworks/Solution_Unit-vnet/subnets/default/serviceAssociationLinks/default-service-association-link and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet.

Regards
Deepak

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,705 questions
{count} votes

Accepted answer
  1. GitaraniSharma-MSFT 49,881 Reputation points Microsoft Employee
    2022-09-14T08:31:25.947+00:00

    Hello @Deepak Bhardwaj ,

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

    I understand that you are unable to delete a subnet and receiving the below error:
    Error: "Subnet default is in use by /subscriptions/xxxxxxxxx/resourceGroups/Solution_Unit/providers/Microsoft.Network/virtualNetworks/Solution_Unit-vnet/subnets/default/serviceAssociationLinks/default-service-association-link and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet."

    Could you please confirm if you had a Vnet integration between the Solution_Unit-vnet and a Web App and was it disconnected properly?

    The above error occurs because when you have VNet Integration between a subnet and a Web App (part of App Service Plan), in the backend there is link automatically created (AppServiceLink) and a default delegation on the specified subnet Microsoft.Web/serverFarm and if you delete the Web App/App Service Plan or set subnet delegation to none without disconnecting the VNet integration first, the link gets stuck in the backend and the delegation also, therefore it cannot be removed.

    We have a workaround which you can try to resolve this issue (may or may not work, depending on the situation):

    If you have already deleted the Web App, follow steps 1 to 5. If the Web App hasn't been deleted yet, follow steps 3 to 5.

    1. Recreate the App Service Plan that you had (the one you used for VNet Integration) with the exact same name as before in the exact same region as the vnet.
    2. Recreate the Web App (name of web app does not matter, it is important only for the ASP)
    3. Recreate the VNet Integration from Web App > Networking Blade > New VNet Integration and select the specific subnet
    4. Properly remove the VNet Integration by hitting “Disconnect” in the Web App > Networking > VNet Integration.
    5. Now try and delete the subnet/vnet or set the Subnet Delegation to "none"

    If the above steps do not help in fixing your issue, we may need to raise a support ticket to get the Service Association Link (SAL) deleted from the backend. So if you have a support plan, I request you file a support ticket, else please do let us know, we will try and help you get a one-time free technical support.

    Kindly let us know if the above helped or you need further assistance on this issue.

    ----------------------------------------------------------------------------------------------------------------

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

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. JimmySalian-2011 42,366 Reputation points
    2022-09-14T08:23:36.663+00:00

    Hi @Deepakbharadwaj-0473,

    Please check this thread with similar issue and resolution - unable-to-delete-the-subnet-in-azure.html

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

    0 comments No comments

  2. Samuel Nihipali 5 Reputation points
    2023-07-26T22:22:59.5833333+00:00

    I'm getting this error as well. I had an Web app + Database and didn't realize that I had to disconnect the subnet from the vnet before deleting the resource group. Not I can't delete the subnet or vnet. I've tried recreating but it either fails because the resource already exists or unable to assign the subnet due to it being assigned already. Any chance of getting a one-time support ticket?


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.