Forum Discussion
Schedule script to scale up AppServicePlan
I need to scale up / down a Basic App Service Plan on a daily time.
Example:
8:00 am -> Scale UP B3
8:00 pm -> Scale DOWN B2
Using AZ CLI in PS all work fine with this simple script:
az login
az appservice plan update --name MyAppPlan --resource-group MyResourceGroup --sku B3
But this require that I login manually to Azure
Is it possibile to schedule script in windows task scheduler and integrating authentication ?
I also tried to use Azure Automated Powershell Runbooks with Managed Identity with this script:
But testing the script, I received this error:
"Failed - Only ElasticPremium sku is suported when updating a function app plan. Current plan sku is: Basic."
Could you help me to solve my issue ?
Thank you
My suggestion would be to use Set-AzAppServicePlan in your Automation to do the resize, for example:
Set-AzAppServicePlan -ResourceGroupName "MyResourceGroup" -Name "MyAppPlan" -workerSize Large-workerSize Large equates to B3, and -workerSize Medium is B2
(edit- corrected a copy and paste error spotted by itglobalservice )
6 Replies
- ChrisBradshawIron Contributor
My suggestion would be to use Set-AzAppServicePlan in your Automation to do the resize, for example:
Set-AzAppServicePlan -ResourceGroupName "MyResourceGroup" -Name "MyAppPlan" -workerSize Large-workerSize Large equates to B3, and -workerSize Medium is B2
(edit- corrected a copy and paste error spotted by itglobalservice )
- itglobalserviceCopper ContributorYou've got it ! It worked fine !!!!
Thank you for support. - itglobalserviceCopper Contributor
Thank you Chris.
I will try this week your solution and let you know I noticed that you made a mistake in the example. You wrote "Set-AzFunctionAppPlan" and not "Set-AzAppServicePlan"- ChrisBradshawIron ContributorGood spot- Thanks, I've corrected my reply in case anyone comes across this in the future.