>我正在使用 Azure 模板来设置网站。我希望它输出发布配置文件的内容,以便我可以自动部署。这可能吗?
我当前的模板如下所示:
{
...
"resources": [
{
"type": "Microsoft.Web/sites",
"kind": "app",
"name": "[variables('webapp').name]",
"apiVersion": "[variables('webapp').version]",
"location": "[variables('location')]",
"tags": {},
"properties": {
"serverFarmId": "[variables('webapp').serviceplan.name]",
"name": "[variables('webapp').name]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('webapp').serviceplan.name)]"
]
},
{
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "B1",
"tier": "Basic",
"size": "B1",
"family": "B",
"capacity": 1
},
"kind": "app",
"name": "[variables('webapp').serviceplan.name]",
"apiVersion": "[variables('webapp').serviceplan.version]",
"location": "[variables('location')]",
"properties": {
"name": "[variables('webapp').serviceplan.name]",
"numberOfWorkers": 1
},
"dependsOn": []
}
],
"outputs": {
"manifest": {
"type": "object",
"value": {
"Website": {
"publishUrl": "...",
"userPWD": "...",
"msdeploySite": "..."
}
}
}
}
}
我尝试过使用 listkeys 功能,但据我了解,您需要提供您想要获取的资源的 ID,即发布配置文件,但我不确定如何获得它。
您需要为此使用引用和\或列表键函数。
它看起来像这样:
"publishUrl": "[reference(variables('webapp').name)[%propertynamegoeshere%]]"
其他事情也是如此;但是您需要使用listkeys
函数来获取Web应用程序的密钥。