Scale Up App Service Plan Azure App Services

Azure App Services offer the option to set auto scale rules, auto scale allows you to have the right amount of resources running to handle the load on your application. It allows you to add resources to handle increases in load and save money by removing resources that are sitting idle.

The great thing here is that you can configure your own rules to increase or decrease the instances that you need depends on the load or the resources that your application is consuming.

Here you will be able to find the best practices for auto scale:

This auto scale rules allow us to scale out/the app service plan. Some people want to scale up or scale down the app service plan based on schedule. Unfortunately, we don’t have a direct way to make this possible.

 For that reason, I would like to explain the option that works for me to scale up my app service plan. We will be able to achieve this using automation.

Automation information:

Step By step guide on how to do it:

  • On the marketplace you will need to create an Automation
  • You will need to create an automation account. Fill the data and click on create.
  • On the automation account please check if you have the module installed. AzureRM.Websites.

If not, you can go to the Powershell gallery and install it.

Select the automation account where you want to install it.

  • On the automation account. We will need to create a Runbook. On the type select PowerShell.
  • This will open you and option to edit the PowerShell please add this on it. Please change the name of your app service ,resource group and subscription.  Then click on Publish.
$connectionName = "AzureRunAsConnection"
    # Get the connection "AzureRunAsConnection "
    $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName         

    "Logging in to Azure..."
    Add-AzureRmAccount `
        -ServicePrincipal `
        -TenantId $servicePrincipalConnection.TenantId `
        -ApplicationId $servicePrincipalConnection.ApplicationId `
        -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint 
catch {
    if (!$servicePrincipalConnection)
        $ErrorMessage = "Connection $connectionName not found."
        throw $ErrorMessage
    } else{
        Write-Error -Message $_.Exception
        throw $_.Exception
Select-AzureRmSubscription -SubscriptionId ""
Set-AzureRmAppServicePlan -Name "nameofwebapp" -ResourceGroupName "nameofresourcegroup" -Tier Basic -WorkerSize Medium

  • You can click on start and you will be able to test that is working.
  • You can click on Link to schedule and add a schedule to run the runbook.

Leave a Reply

Your email address will not be published. Required fields are marked *