Unable to Delete Azure Virtual Network and Function App

Andrew Eickemeyer 0 Reputation points
2024-10-18T23:04:34.5266667+00:00

I am attempting to delete an Azure Virtual Network but keep receiving the error:

"Failed to delete subnet 'subnet-2'. Error: Subnet subnet-2 is in use by rg-aeickemeyer-001/providers/Microsoft.Network/virtualNetworks/vnet-aeickemeyer-001/subnets/subnet-2/serviceAssociationLinks/legionservicelink'>vnet-aeickemeyer-001/subnet-2/legionservicelink and cannot be deleted."

This is preventing me from deleting an Azure Function App that I created with VNet integration enabled. This issue seems to be the same as those found in the following help threads:

I've tried the workarounds from these threads, but they don't work. I don't have a support plan because this is my personal account, so I can't create a support ticket. The threads above mention getting a free support ticket for this issue. Can someone from Microsoft respond to help me resolve this? I don't need these resources anymore.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,091 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 27,911 Reputation points
    2024-10-19T04:22:26.0533333+00:00

    @Andrew Eickemeyer glad to see you were able to resolve your issue. Thanks for posting your solution so that others experiencing the same thing can easily reference this.

    Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.

    Issue Summary:

    The issue was related to deleting an Azure Virtual Network due to a service association link that was preventing the deletion of a subnet. This, in turn, was blocking the deletion of an Azure Function App with VNet integration enabled. The error message received was:

    "Failed to delete subnet 'subnet-2'. Error: Subnet subnet-2 is in use by rg-aeickemeyer-001/providers/Microsoft.Network/virtualNetworks/vnet-aeickemeyer-001/subnets/subnet-2/serviceAssociationLinks/legionservicelink'>vnet-aeickemeyer-001/subnet-2/legionservicelink and cannot be deleted."

    Resolution:

    The issue was resolved by disconnecting the VNet integration. you navigated to the networking blade for the Function App and found an extra step under the outbound configurations. There was a hyperlink with the name of the subnet that led to the page with the option to disconnect the VNet integration. Once this was done, the subnet and the associated resources could be deleted successfully.


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.