Remove Auto Scaling from an Azure App Service using Azure PowerShell


I needed to remove some auto scale settings from one of my App Services using Azure PowerShell so I decided to document that here.  Here are the steps:

  • Login
  • Set the subscription context
  • Get the existing Auto Scale rules based on Resource Group
  • Remove the Auto Scale rule

Please keep reading for more details.

Login

Execute the following cmdlet to login.

Login-AzureRmAccount

Executing that cmdlet opens a challenge/response window, enter your credentials and the result is similar to that shown in Figure 1.

image

Figure 1, how to login into Azure using Azure PowerShell

Set the subscription context

Next, execute the Set-AzureRmContext cmdlet.

Set-AzureRmContext -SubscriptionId "25ec5bae-####-####-####-############"

Set the subscription Id to the subscription into which you want to create the Azure App Service Web App, the results is similar to that in Figure 2.

image

Figure 2, how to set the Azure subscription using Azure PowerShell

Get the existing Auto Scale rules based on Resource Group

You set Auto Scale rules on App Service Plans which I discuss here.  Keep in mind if you create an Auto Scale rule, when it is triggered all the App Services running on that ASP will scale out.  As well, when you deleted the Auto Scale rule, it is for all the App Services running in that ASP.  Execute this cmdlet to find the name of the Auto Scale rule you would like to remove.

Get-AzureRmAutoscaleSetting -ResourceGroup "Default-Web-NorthCentralUS"

I will assume you can already find the Resource Group in which the ASP is running.  You will see that on the Overview blade of the App Service Plan.  The output of the cmdlet is shown in Figure 3.

image

Figure 3, how to view Auto Scale rule using Azure PowerShell

Remove the Auto Scale rule

Lastly, use the name of the Auto Scale rule with the following cmdlet to delete it.

Remove-AzureRmAutoscaleSetting -ResourceGroup "Default-Web-NorthCentralUS" -Name "CH1S1-Default-Web-NorthCentralUS"

The output is represented in Figure 4.

image

Figure 4, how to remove Auto Scale rules using Azure PowerShell

Then execute the Get-AzureRmAutoscaleSetting cmdlet and the rule will not be present any longer.

Comments (0)

Skip to main content