Delete subnet serviceAssociationLinks Container and AppServiceLink


Subnet delegation enables you to designate a specific subnet for an Azure PaaS service of your choice that needs to be injected into your virtual network. Subnet delegation provides full control to the customer in managing the integration of Azure services into their virtual networks.

When you delegate a subnet to an Azure service, you allow that service to establish some basic network configuration rules for that subnet, which help the Azure service operate its instances in a stable manner. As a result, the Azure service may establish some of the following pre or post-deployment conditions:

Using the az cli with a logged-in user to obtain an Access token

az account get-access-token --resource

then using Postman to issue the following calls:

add to the headers: “Authorization: Bearer |accesstoken from cli|”

DELETE  Service Association{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default?api-version=2018-10-01

DELETE Network Profle{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkProfiles/{networkProfileName}?api-version=2020-05-01

after this i could remove the delegation using the Portal, CLI or PowerShell

Another one

Failed to delete subnet 'xxx'. Error: Subnet xxx is in use by my-resource-group/providers/Microsoft.Network/virtualNetworks/my-vnet/subnets/xxx/serviceAssociationLinks/AppServiceLink'>my-vnet/xxx/AppServiceLink and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See

If you deleted the web app or the App Service plan without disconnecting the VNet integration first too bad for you, you will not be able to do any update/delete operations on the virtual network or subnet that was used for the integration with the deleted resource. A subnet delegation ‘Microsoft.Web/serverFarms’ will remain assigned to your subnet and will prevent the update/delete operations.

In order to update/delete the subnet or virtual network again you need to re-create the VNet integration and then disconnect it:

  1. Re-create the App Service plan and web app (it is mandatory to use the exact same web app name as before).
  2. Navigate to the ‘Networking’ blade on the web app and configure the VNet integration.
  3. After the VNet integration is configured, select the ‘Disconnect’ button.
  4. Delete the App Service plan or web app.
  5. Update/Delete the subnet or virtual network.

If you can’t perform the above, please contact Microsoft Support.

Leave a Reply

Your email address will not be published. Required fields are marked *