1
votes

I was attempting to test the new VNet Integration for App Services so I connected my App Service to the subnet 'AppServicesSubnet'. It never worked, always was showing a loading message. So after a few days I then disconnected it, which it said failed but the status showed as 'not configured' regardless.

However I am unable to delete the subnet 'AppServicesSubnet'. It says

"Failed to delete subnet 'AppServicesSubnet'. Error: Subnet AppServicesSubnet is in use by AppGroup-DEV/providers/Microsoft.Web/serverfarms/AppServicePlan-DEV and cannot be deleted."

So I then deleted the app service plan 'AppServicePlan-DEV' this took about 30 minutes and succeeded. However I can still not delete the subnet 'AppServicesSubnet' with the same error given above.

I also cannot delete the virtual network 'Network-DEV' as a similar message is reported:

"Failed to delete virtual network 'Network-DEV'. Error: Subnet AppServicesSubnet is in use by AppGroup-DEV/providers/Microsoft.Web/serverfarms/AppServicePlan-DEV and cannot be deleted."

The app service plan 'AppServicePlan-DEV' doesn't even exist anymore so I'm not sure how to clean up this subnet.

Any help on how to just get rid of this lingering subnet would be much appreciated.

Background on the new App Service VNet Integration Preview can be found here: https://blogs.msdn.microsoft.com/appserviceteam/2018/10/17/new-app-service-vnet-integration-feature/ and here: https://docs.microsoft.com/en-us/azure/app-service/web-sites-integrate-with-vnet#new-vnet-integration

3

3 Answers

1
votes

Was able to work around this error after it hit us this week. Wanted to test the preview vnet integration. Turned it on, decided it was what we were looking for, then deleted it (to go back and add to automation) only to have automation fail because of this error.

I worked around it by:

  • adding back the preview connection to the app service I had originally add/ deleted it from.
  • Then disconnected it again.

This time, however, I was able to delete the subnet as expected.

Definitely a bug somewhere. If you have gone so far as to delete the app service itself and are still having this error...that's a different story.

1
votes

I had a similar issue. I wasn't able to delete a a subnet because it was in use by some resource that didn't exist (in my point of view)....

So i ran this cli script to delete my subnet and my vNet.

RES_GROUP={Replace to your rg}
VNET_NAME={Replace to your vnet}
SUBNET_NAME={Replace to your subnet}

NETWORK_PROFILE_ID=$(az network profile list --resource-group $RES_GROUP --query [0].id --output tsv)
az network profile delete --id $NETWORK_PROFILE_ID -y

SAL_ID=$(az network vnet subnet show --resource-group $RES_GROUP --vnet-name $VNET_NAME --name $SUBNET_NAME --query id --output tsv)/providers/Microsoft.ContainerInstance/serviceAssociationLinks/default
az resource delete --ids $SAL_ID --api-version 2018-07-01

az network vnet subnet update --resource-group $RES_GROUP --vnet-name $VNET_NAME --name $SUBNET_NAME--remove delegations 0
az network vnet subnet delete --resource-group $RES_GROUP --vnet-name $VNET_NAME --name $SUBNET_NAME
az network vnet delete --resource-group $RES_GROUP --name $VNET_NAME
0
votes

I tried again after a month and was able to delete the subnet in question. I guess it just takes some time for the new App Service VNet Integration (Preview) to be unregistered after it is disconnected.