gpt4 book ai didi

azure - 如何使用 cloningInfo 创建 azure 插槽?

转载 作者:行者123 更新时间:2023-12-02 08:04:22 25 4
gpt4 key购买 nike

我正在尝试向我的模板添加一个插槽,并且希望让它克隆生产插槽的配置(就像门户提供的那样)。似乎 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": {}
}

enter image description here

关于azure - 如何使用 cloningInfo 创建 azure 插槽?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47824538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com