有没有办法使用 powershell 升级 azure 应用程序服务计划?

Jes*_*ith 4 powershell azure

尝试使用 powershell 命令 Set-AzAppServicePlan 将应用服务计划从标准 S1 计划升级到标准 S3 计划。似乎没有办法定义“S3”。

Set-AzAppServicePlan -Name $appServicePlanName -ResourceGroupName $resourceGroupName -Tier "Standard"  -NumberofWorkers 1 -WorkerSize "Small";
Run Code Online (Sandbox Code Playgroud)

我已经在“-Tier”参数中尝试了各种不同的值,例如“StandardS3”或“StandardV3”,并且它始终默认为“Standard S1”

小智 8

这是不太令人困惑的方法

# Set the App Service Plan name and resource group name
$appServicePlanName = "YourAppServicePlanName"
$resourceGroupName = "YourResourceGroupName"

# Set the SKU name to P0v3
$sku = "P0v3"

# Get the App Service Plan
$appServicePlan = Get-AzAppServicePlan -Name $appServicePlanName -ResourceGroupName $resourceGroupName

# Set the SKU for the App Service Plan
$appServicePlan.Sku.Name = $sku
$appServicePlan | Set-AzAppServicePlan
Run Code Online (Sandbox Code Playgroud)

  • 这种方式直观且易于配置。谢谢你! (2认同)

Dje*_*eth 7

对于像我一样带着彻底绝望来到这里的人来说,这里有更多的背景信息。我尝试将 AppServicePlan 从 P1v2 升级到 P2v2。然而,这转化为:

Set-AzAppServicePlan -Name $appServicePlanName -ResourceGroupName $resourceGroupName -Tier "PremiumV2" -NumberofWorkers 1 -WorkerSize "Medium"

请注意,-Tier指向 Tier系列-WorkerSize指向大小(在 Portal 或 az cli 中,这是 P1、P2、P3,但在 AzPowershell 中,这是小/中/大)。

P1v2 =-WorkerSize "Small"和 P3v2 =-WorkerSize "Large"

你无法编造这些东西...