我正在尝试向我的模板添加一个插槽,并且希望让它克隆生产插槽的配置(就像门户提供的那样)。似乎 cloningInfo 是执行此操作的方法,但 sourceWebAppId 似乎不足以完成此操作。当我只指定该属性时,我收到一个 HTTP 错误,这没有帮助。我找不到任何使用 cloningInfo 复制插槽的示例模板。
这是我的网站资源:
{
"apiVersion": "2016-08-01",
"name": "staging",
"type": "slots",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/Sites/', variables('webSiteName'))]"
],
"properties": {
"cloningInfo":{
"sourceWebAppId": "[reference(concat('Microsoft.Web/Sites/', variables('webSiteName')), '2016-08-01')]"
}
},
"tags": {}
}
最佳答案
如果您有一个通过高级应用服务计划托管的 Web 应用。
我们可以使用以下 ARM 模板来克隆 WebApp。 sourceWebAppId是 WebApp 的资源 ID。我们还需要 serverfarm id。
注意:
广告位名称为WebsiteName/xxxx
如何扩大您的定价等级,请参阅此 document .
ARM 模板:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"webSiteName": {
"type": "string",
"metadata": {
"description": "The site name. To use the default value, do not specify a new value."
}
},
"ServicePlanName": {
"type": "string",
"metadata": {
"description": "The host name. To use the default value, do not specify a new value."
}
}
},
"variables": {
},
"resources": [
{
"name": "[concat(parameters('webSiteName'), '/staging')]",
"type": "Microsoft.Web/sites/slots",
"apiVersion": "2016-08-01",
"location": "[resourceGroup().location]",
"tags": {},
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms/', parameters('ServicePlanName'))]",
"cloningInfo": {
"sourceWebAppId": "[resourceId('Microsoft.Web/Sites/', parameters('webSiteName'))]"
}
},
"resources": [
]
}
],
"outputs": {}
}
关于azure - 如何使用 cloningInfo 创建 azure 插槽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47824538/