【问题标题】:How do I use Powershell to create an Azure Web App that runs on Linux?如何使用 Powershell 创建在 Linux 上运行的 Azure Web 应用?
【发布时间】:2018-07-16 00:40:14
【问题描述】:

在 Azure 门户中,我可以在创建 Web 应用程序时指定主机操作系统。如何通过 Powershell 实现相同的目标?我查看了 New-AzureRmWebAppNew-AzureRmAppServicePlan cmdlet 的文档,但找不到任何关于如何将操作系统作为参数传递的参考资料。我还通过 Ubuntu 上的 Azure CLI 2.0 进行了尝试,但没有成功。

【问题讨论】:

    标签: powershell azure


    【解决方案1】:

    试试下面的命令,它在我这边运行良好,它会在其中创建一个 Linux 服务计划和一个 Linux Web 应用程序。

    New-AzureRmResource -ResourceGroupName <ResourceGroupName> -Location <Location> -ResourceType microsoft.web/serverfarms -ResourceName <YourPlanName> -kind linux -Properties @{reserved="true"} -Sku @{name="S1";tier="Standard"; size="S1"; family="S"; capacity="1"} -Force
    New-AzureRmWebApp -ResourceGroupName <ResourceGroupName> -Name <YourAppName> -AppServicePlan <YourPlanName>
    

    在 Azure 资源浏览器中检查。

    【讨论】:

    • 起初,当我尝试这个时,我得到了以下错误:pastebin.com/3ffdbxXU。但是当我尝试另一个地区(美国中部)时,它工作得很好。奇怪的是,无法通过 New-AzureRmAppServicePlan cmdlet 创建 Linux 应用服务计划。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-07
    • 1970-01-01
    相关资源
    最近更新 更多