问题
In the Azure Portal I'm able to specify the host operating system when creating a Web App. How can I achieve the same via Powershell? I' looked into the docs of the New-AzureRmWebApp and New-AzureRmAppServicePlan cmdlets but wasn't able to find any references on how to pass the OS as parameter. I also tried via the Azure CLI 2.0 on Ubuntu without success.
回答1:
Try the command below, it works fine on my side, it creates a Linux Service Plan and a Linux web app in it.
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>
Check it in the Azure Resource Explorer.
来源:https://stackoverflow.com/questions/51353318/how-do-i-use-powershell-to-create-an-azure-web-app-that-runs-on-linux