【问题标题】:Update Azure Website instance size (Small, Medium, Large) with Powershell使用 Powershell 更新 Azure 网站实例大小(小、中、大)
【发布时间】:2014-11-12 16:17:33
【问题描述】:

有没有办法使用 PowerShell 来扩展 Azure 网站实例大小(不是实例计数)?我还没找到路。

我知道可以使用 Azure CLI 或从门户完成,但我希望能够使用 PowerShell 来完成。这可能吗?

我想更新现有网站实例大小,而不是创建新网站。

【问题讨论】:

    标签: powershell azure


    【解决方案1】:

    是的,您首先需要知道您的网站所属的资源组和虚拟主机计划的名称,您可以从new Azure Portal 获得。然后,您可以将 worker 大小更改为 0(小)、1(中)或 2(大)。

    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
    

    【讨论】:

    • 酷!让我在几个小时后签出(现在不能签出),我会标记为已解决
    • 我遇到了一个身份验证错误,我首先通过调用 Add-AzureAccount 解决了该错误(来源:social.msdn.microsoft.com/forums/azure/es-es/…)。非常感谢您的回答,很有帮助
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-11-03
    • 2014-01-29
    • 2021-04-27
    • 1970-01-01
    • 2021-01-24
    • 1970-01-01
    • 2021-06-03
    相关资源
    最近更新 更多