Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Azure Website instance size (Small, Medium, Large) with Powershell

Is there a way to scale an Azure WebSite instance size (not instance count) using PowerShell? I haven't found the way.

I know it can be done using Azure CLI or from the Portal, but I want to be able to do it with PowerShell. Is this posible?

I want to update an existing WebSite instance size, not create a new website.

like image 600
Christian Rodriguez Avatar asked Feb 22 '26 12:02

Christian Rodriguez


1 Answers

Yes, you first need to know the name of the Resource Group and Web Hosting Plan to which your website belongs, which you can get from the new Azure Portal. Then you can change the worker size to 0 (Small), 1 (Medium) or 2 (Large).

Switch-AzureMode AzureResourceManager

$resourceGroup = "MyResourceGroup"
$webHostingPlan = "MyWebHostingPlan"

$whp = Get-AzureResource `
    -Name $webHostingPlan `
    -ResourceGroupName $resourceGroup `
    -ResourceType "Microsoft.Web/serverFarms" `
    -ApiVersion 2014-04-01

$newWorkerSize = 1
$whp.Properties.workerSize = $newWorkerSize
$whp.Properties.workerSizeId = $newWorkerSize

Set-AzureResource `
    -Name $webHostingPlan `
    -ResourceGroupName $resourceGroup `
    -ResourceType "Microsoft.Web/serverFarms" `
    -ApiVersion 2014-04-01 `
    -PropertyObject $whp.Properties
like image 55
Chris Fulstow Avatar answered Feb 24 '26 17:02

Chris Fulstow



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!