Search code examples
azureazure-web-app-serviceazure-app-service-plans

Removing last Azure app service also removes parent plan


Here is my simplified Azure architecture:

  • ResourceGroup1 => AppServicePlan
  • ResourceGroup2 -> AppService1, AppService2

Once this architecture is in place, I remove the apps one by one. When i delete (tried in portal and with PowerShell as well) the last app, the plan gets also deleted...

Is it by design or a bug ?


Solution

  • It is by design. The reason it was done that way is to avoid continuing to charge for an unused Plan, which would take some customers by surprise if they don't fully grasp the distinction between Plan and Web App.

    So the only time a Plan can be empty is right after it's created. After that, any transition from 1 to 0 contained Web Apps triggers the deletion of the Plan.

    If you want to avoid this behavior, the simplest workaround is to include a 'dummy' Web App in the Plan to keep it alive. You can stop that Web App, so it doesn't consume any resources on the VMs.