在Azure Web App的ARM模板中,如何指定应用程序的堆栈设置(.NET,.NET Core,PHP等)?我看不到任何字段。
谢谢
答案 0 :(得分:1)
在门户网站上创建Azure Web应用程序时,选择Running stack
作为.Net Core 3.0(Current)
。
然后单击Review+Create
> Download a template for automation
。您将看到包含metadata
属性的ARM模板,当前堆栈值为dotnetcore
。
{
"apiVersion": "2018-02-01",
"name": "[parameters('name')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"properties": {
"name": "[parameters('name')]",
"siteConfig": {
"appSettings": [],
"metadata": [
{
"name": "CURRENT_STACK",
"value": "[parameters('currentStack')]"
}
]
},
// redacted some values
}
}
答案 1 :(得分:1)
在Joey的答案中,.NET Core的CURRENT_STACK的值为dotnetcore
。
{
"type": "Microsoft.Web/sites",
"apiVersion": "2018-11-01",
"name": "<name>",
"location": "[resourceGroup().location]",
"kind": "app",
"properties": {
"enabled": true,
"siteConfig": {
"metadata": [
{
"name": "CURRENT_STACK",
"value": "dotnetcore"
}
]
}
}
}
答案 2 :(得分:0)
作为一个小提示:提议的解决方案仅适用于新的WebApp ...如果要将现有的WebApp从.Net4.x更改为.NetCore,还必须清除“ netFrameworkVersion”。否则堆栈不会更改。
所以正确的是:
{
"apiVersion": "2018-02-01",
"name": "[parameters('name')]",
"type": "Microsoft.Web/sites",
"location": "[parameters('location')]",
"properties": {
"name": "[parameters('name')]",
"siteConfig": {
"appSettings": [],
"netFrameworkVersion": "",
"metadata": [
{
"name": "CURRENT_STACK",
"value": "dotnetcore"
}
]
},
// redacted some values
}
}