Due to the lack of a simple solution, I created a one-click deployment to accomplish what you ask.
https://github.com/jraps20/jrap-AzureVerticalScaling
overview
My approach uses Azure automation modules. With the one-click deployment method, you can fully get started in minutes. Two complementary launch books (ScaleAppServicePlansUp and ScaleAppServicePlansDown) work together to store, read and modify any service plans for the applications you choose. The primary goal for these Runbooks is non-production environments.
Unfortunately, the code is too long to be included in this answer (so yes, it will be basically a link-only answer).
Pseudo code
Reduce
Iterate across all Resource Groups (or pass in specific one) Iterate across all App Service Plans (or pass in specific one) Iterate across all App Services (identify Tier-specific settings) During iteration, the current App Service Plan Service Tier is stored in Azure Automation Variables (3 distinct variables for each App Service Plan) Within each App Service Plan, each App Service is iterated to identify tier-specific settings. Some of these settings include: AlwaysOn, Use32BitWorkerProcess, and ClientCertEnabled. All current settings are stored in Azure Automation Variables. All App Service Plans are then scaled down to the FREE tier.
Zoom in
Iterate across all Resource Groups (or pass in specific one) Iterate across all App Service Plans (or pass in specific one) Iterate across all App Services (identify Tier-specific settings) During iteration, the original App Service Plan Service Tier is retrieved from Azure Automation Variables (3 distinct variables for each App Service Plan) Within each App Service Plan, each App Service is iterated and any previously stored tier-specific settings are retrieved. All App Service Plans are then scaled up to their original tier. All App Services with tier-specific settings are reapplied to their original values.
Additional Resources
source share