Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't delete Azure App Service plan

I am trying to delete everything related to a mobile app back-end I previously created, and I was able to delete everything but the app service plan.

It shows that the App service plan has no connected apps and no pricing tier, but I still can't delete it:

App Service plan]

And when I try to click on the plan to see its details, the portal goes into an infinite loading state and nothing else happens:

App service plan details

Can anyone help me solve this problem?

like image 785
Albert_S Avatar asked Dec 15 '15 10:12

Albert_S


People also ask

How do I change the app service plan for Azure function app?

In the Azure portal, search for and select App services and select the app that you want to move. From the left menu, select Change App Service plan. In the App Service plan dropdown, select an existing plan to move the app to.

What is Azure App Service plan?

An App Service plan defines a set of compute resources for a web app to run. These compute resources are analogous to the server farm in conventional web hosting. One or more apps can be configured to run on the same computing resources (or in the same App Service plan).


3 Answers

I had a similar issue. The app service plan couldn't be deleted, but I wasn't able to access is properly from the Azure Portal. I managed to remove the plan like this:

  1. Make sure all related apps (web jobs, ...) were removed.
  2. Open PowerShell and log in to your Azure account: Login-AzureRmAccount.
  3. Remove the app service plan: Remove-AzureRmAppServicePlan -Name <name> -ResourceGroupName <resourcegroup>.
like image 190
Ramon de Klein Avatar answered Oct 17 '22 11:10

Ramon de Klein


If you delete the ResourceGroup it is located in, it will dissapear.

Nowadays it's possible to move most resources between ResourceGroups. So you can create a new ResourceGroup, for example "ToBeDeleted", and then move the AppServicePlan to "ToBeDeleted" and then remove the ResourceGroup.

enter image description here

like image 16
Jorn.Beyers Avatar answered Oct 17 '22 11:10

Jorn.Beyers


Once I had a WebApp in an App Service Plan (only one). There was some problem with the Aplication, and it was consuming all the CPU of the plan. I then moved the WebApp to another plan. It started to consume all the CPU (~100%) in the new (destination) App Service Plan.

After moving the app, in Azure portal, the original App Service Plan appeared as having "0 apps, 0 slots" (empty), yet the CPU was still around 100%. Weird!

Azure wouldn't let me remove that empty origin App Service Plan, telling me to first remove all the App it contained (which should be none).

I guessed Azure had registered the movement of the WebApp to the destination App Service Plan, yet some process was somehow stuck in the original App Service Plan, and until the process wouldn't end, I wouldn't be able to remove the App Service Plan (hence I would pay for it).

My trick here was to Scale Down that original App Service Plan. It was Premium, and I scaled it down to Free. When you scale up/down, Azure migrate deploys your app on a new set of machines. That is the stuck process would then forcely disappear. No new process was spawned on the new machine, as Azure had no account of any app being deployed on that App Service Plan anyway :)

Once scaled down to Free, I was instantly able to remove the empty plan.

So, in case you have any such problem, scale Up or Down the plan. It will assign new VMs, with no remaining processes nor new app process (as no apps are registred to the empty plan!)

like image 6
Alexandre Dumont Avatar answered Oct 17 '22 10:10

Alexandre Dumont