Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oledid/a163af63bd1723db65c9e0e3b9a7f16e to your computer and use it in GitHub Desktop.
Save oledid/a163af63bd1723db65c9e0e3b9a7f16e to your computer and use it in GitHub Desktop.
PowerShell and CLI to manage App Service Plan sizing

Manage App Service Plan count and SKU

Get the number of worker nodes serving the app service plan

(Get-AzAppServicePlan -ResourceGroupName "<resource group name>" -Name "<app service plan name>").Sku.Capacity
az appservice plan show --resource-group "<resource group name>" --name "<app service plan name>" --output jsonc --query "sku.capacity"

Update the number of worker nodes

Since you are leveraging PremiumV2, the allowed values are 1-30

Set-AzAppServicePlan -ResourceGroupName "<resource group name>" -Name "<app service plan name>" -NumberOfWorkers <1 - 30>
az appservice plan update --resource-group "<resource group name>" --name "<app service plan name>" --number-of-workers <1 - 30>

Gets the SKU (pricing tier) for the app service plan

(Get-AzAppServicePlan -ResourceGroupName "<resource group name>" -Name "<app service plan name>").Sku.Size
az appservice plan show --resource-group "<resource group name>" --name "<app service plan name>" --output jsonc --query "sku.size"

Updates the SKU (pricing tier) for the app service plan

Set-AzAppServicePlan -ResourceGroupName "<resource group name>" -Name "<app service plan name>" -WorkerSize "<Small | Medium | Large>"
az appservice plan update --resource-group "<resource group name>" --name "<app service plan name>" --sku "<P1v2 | P2v2 | P3v2>"

Getting the available Skus, sizes and worker count for a plan

Unfortunately, there isn't a PowerShell to get the available SKUs. Instead, you can get this via a REST call. The documentation for this can be found here:

https://docs.microsoft.com/en-us/rest/api/appservice/appserviceplans/getserverfarmskus#code-try-0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment