Azure应用服务ApiApp [英] Azure App Service ApiApp
问题描述
我正在尝试使用PowerShell在 Azure应用服务中创建一个API应用.
I am trying to create an API App in Azure App Service with PowerShell.
默认情况下,我正在调用的cmdlet始终创建一个Web应用程序.如果有可能,我想知道如何将类型/种类指定为Api App
而不是Web App
?
The cmdlet I am calling always create a Web App by default. If it is possible, I would like to know how I can specify the type/kind to be Api App
instead of Web App
?
New-AzureRmWebApp -Name $name -Location $location -AppServicePlan $plan -ResourceGroupName $resourceGroup
从我的阅读来看,除了图标之外,两者之间没有太大区别,如果这是我的应用的全部意义,是否值得将类型设置为"Api App"?
From my reading there is not much different between both except the icon, is it worth it to set the type to "Api App" if it's what my app is all about?
我正在使用5.4.0版的AzureRM PowerShell模块.
I am using version 5.4.0 of AzureRM PowerShell module.
> Get-Module "AzureRM"
ModuleType Version Name
---------- ------- ----
Script 5.4.0 AzureRM
推荐答案
只需调用New-AzureRmResource
并传入-Kind 'api'
:
# CREATE "just-an-api" API App
$ResourceLocation = "West US"
$ResourceName = "just-an-api"
$ResourceGroupName = "demo"
$PropertiesObject = @{
# serverFarmId points to the App Service Plan resource id
serverFarmId = "/subscriptions/SUBSCRIPTION-GUID/resourceGroups/demo/providers/Microsoft.Web/serverfarms/plan1"
}
New-AzureRmResource -Location $ResourceLocation `
-PropertyObject $PropertiesObject `
-ResourceGroupName $ResourceGroupName `
-ResourceType Microsoft.Web/sites `
-ResourceName "just-an-api/$ResourceName" `
-Kind 'api' `
-ApiVersion 2016-08-01 -Force
..产生一个API App,这是一种api
类型的Microsoft.Web/sites
资源类型:
..which produces an API App, a Microsoft.Web/sites
resource type of the api
kind:
等等..您是怎么想到这些东西的?
访问 https://resources.azure.com 并导航到现有的API应用程序,构建PowerShell通过将PowerShell选项卡与JSON资源定义中的所需值组合在一起来实现语法.
Visit https://resources.azure.com and navigate to an existing API App, build the PowerShell syntax by combining the PowerShell tab with the desired values from the JSON resource definition.
这篇关于Azure应用服务ApiApp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!