是否有任何azure API App cmdlet?

时间:2018-05-29 14:39:37

标签: azure azure-resource-manager azure-powershell

有人知道cmdlet在PowerShell中创建API应用程序吗?我试着寻找它,却找不到任何东西。我认为New-AzureRmWebApp是通过传递一些type的方式,有人知道吗?

1 个答案:

答案 0 :(得分:1)

正如evilSnobulink中提到的那样,它略有修改。所以如果有人需要,我会发布答案。

# CREATE "just-an-api" API App

$ResourceLocation = "West US"
$ResourceName = "just-an-api"
$ResourceGroupName = "demo"

# If we want to create under a specific app plan, we need to pass the server farmid in format
$serverFarmId = "/subscriptions/<subscription_id>/resourceGroups/<resource_group_name>/providers/Microsoft.Web/serverfarms/<app_service_plan_name>;

#If nothing is passed inside $PropertiesObject, it create s default app service plan.
$PropertiesObject = @{"serverFarmId"=$serverFarmId}

New-AzureRmResource -Location $ResourceLocation `
    -PropertyObject $PropertiesObject `
    -ResourceGroupName $ResourceGroupName `
    -ResourceType Microsoft.Web/sites `
    -ResourceName "just-an-api" ` #removing $ResourceName, as either one is required.
    -Kind 'api' `
    -ApiVersion 2016-08-01 -Force