Update Azure website instance size (small, medium, large) with Powershell

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

I know it can be done using the Azure CLI or from the portal, but I want to be able to do it using PowerShell. Is it possible?

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

+3


source to share


1 answer


Yes, first you need to know the name of the resource group and the web hosting plan your site belongs to, which you can get from the new Azure Portal . Then you can change the work 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

      

+4


source







All Articles