1
votes

I have an Azure VNet and it was used for Azure Environment Service. Since it is no longer used, I deleted all relative resources. But when I delete this VNet, there is an error :

Failed to delete virtual network 'name-vnet'. Error: Subnet legoexttest-subnet is in use by /subscriptions/XXX/providers/Microsoft.Web/hostingEnvironments/name and cannot be deleted.

I've found this Troubleshooting: Failed to delete a virtual network document. I checked the issues one by one and still didn't solve my problem.

I'm sure that there is no connected device or service endpoint in my VNet. But there is an Address Space and a Subnet in it. I also can't delete either of them because the same error :

Failed to delete subnet 'name-subnet'. Error: Subnet legoexttest-subnet is in use by /subscriptions/XXX/providers/Microsoft.Web/hostingEnvironments/name and cannot be deleted.

I just don't know what is /providers/Microsoft.Web and how to delete or enable this use in order to delete my VNet in Azure.

1
/providers/Microsoft.Web means Microsoft provide the Web service. For your issue, which location you select and you can try to delete the vnet with PowerShell command or Azure CLI.Charles Xu

1 Answers

0
votes

Go to https://resources.azure.com

Select the correct subscription and navigate down the hierarchy to find your VNET and look through the resource for dependencies. Remove those dependencies manually and try delete your VNET again.

From the error message you have it seems like you have a WebApp or FunctionsApp (i.e. An App Service Plan) that is dependant on the VNET, possibly linked via a service endpoint, have you double checked.

Lastly, it can take some time for Azure to decommission an App Service plan, if you were trying to delete immediately, try again after a couple of hours.

enter image description here