Due to the lack of a simple solution, I created a one-click deploy to do what you're asking.
https://github.com/jraps20/jrap-AzureVerticalScaling
Overview
My approach uses Azure Automation Runbooks. Via the one-click deploy method you can get fully up and running in a few minutes. The two complementary runbooks (ScaleAppServicePlansUp and ScaleAppServicePlansDown) work together to store, read and modify whichever App Service Plans you choose. The primary target for these runbooks are non-prod environments.
The code is too long to include in this answer, unfortunately (so yes, this will mostly be a link-only answer).
Pseudo Code
Scale Down
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.
Scale Up
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
Disclaimer
I became aware of Sam Spoerles technique after completing my work. The benefits of my approach over his are as follows:
- One-click deployment to Azure
- Generic or specific based on parameters
- Uses updated Az modules instead of AzureRm modules
- Relies on storage to retain the previous state, via Automation Variables