无法使用 ARM 模板为应用服务计划添加自动扩展 属性
Not able to add autoscaleout property for appservice plan using ARM template
我创建了 ARM 模板来添加横向扩展 属性 并使用上面的模板作为参考
{
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "S1",
"tier": "Standard",
"size": "S1",
"family": "S",
"capacity": 1
},
"kind": "app",
"name": "[variables('ServerFarm_gateway_name')]",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"resources": [
{
"name": "[concat(variables('ServerFarm_gateway_name'),'-autoscaleout')]",
"type": "Microsoft.Insights/autoscaleSettings",
"apiVersion": "2015-04-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', variables('ServerFarm_gateway_name'))]"
],
"properties": {
"name": "[concat(variables('ServerFarm_gateway_name'),'-autoscaleout')]",
"enabled": true,
"targetResourceLocation": "[resourceGroup().location]",
"profiles": [
{
"name": "Auto created scale condition 1",
"capacity": {
"minimum": "1",
"maximum": "5",
"default": "1"
}
},
{
"name": "{\"name\":\"Auto created scale condition\",\"for\":\"Auto created scale condition 1\"}",
"capacity": {
"minimum": "1",
"maximum": "5",
"default": "1"
}
}
]
}
}
],
"dependsOn": []
}
使用 VSTS 管道部署时抛出错误。
##[error]At least one resource deployment operation failed. Please list deployment operations for
Please see https://aka.ms/DeployOperations for usage details.
##[error]Details:
##[error]BadRequest: {
"code": "UnsupportedRequestContent",
"message": "Request content is not well formed or supported."
}
##[error]Task failed while creating or updating the template deployment.
当我从模板中删除资源部分时,就没有问题了。
我认为您的问题出在您对自动缩放 arm 模板工作原理的理解上。这些应定义为顶级资源并引用它适用的资源。
您的模板应如下所示:
{
"type": "microsoft.insights/autoscalesettings",
"name": "[concat(variables('ServerFarm_gateway_name'),'-autoscaleout')]",
"apiVersion": "2015-04-01",
"location": "[resourceGroup().location]",
"properties": {
"profiles": [
{
"name": "Auto created scale condition 1",
"capacity": {
"minimum": "1",
"maximum": "5",
"default": "1"
}
}
],
"enabled": true,
"targetResourceUri": "[resourceId('Microsoft.Web/serverfarms', variables('ServerFarm_gateway_name'))]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('ServerFarm_gateway_name'))]"
]
}
我创建了 ARM 模板来添加横向扩展 属性 并使用上面的模板作为参考
{
"type": "Microsoft.Web/serverfarms",
"sku": {
"name": "S1",
"tier": "Standard",
"size": "S1",
"family": "S",
"capacity": 1
},
"kind": "app",
"name": "[variables('ServerFarm_gateway_name')]",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"resources": [
{
"name": "[concat(variables('ServerFarm_gateway_name'),'-autoscaleout')]",
"type": "Microsoft.Insights/autoscaleSettings",
"apiVersion": "2015-04-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', variables('ServerFarm_gateway_name'))]"
],
"properties": {
"name": "[concat(variables('ServerFarm_gateway_name'),'-autoscaleout')]",
"enabled": true,
"targetResourceLocation": "[resourceGroup().location]",
"profiles": [
{
"name": "Auto created scale condition 1",
"capacity": {
"minimum": "1",
"maximum": "5",
"default": "1"
}
},
{
"name": "{\"name\":\"Auto created scale condition\",\"for\":\"Auto created scale condition 1\"}",
"capacity": {
"minimum": "1",
"maximum": "5",
"default": "1"
}
}
]
}
}
],
"dependsOn": []
}
使用 VSTS 管道部署时抛出错误。
##[error]At least one resource deployment operation failed. Please list deployment operations for
Please see https://aka.ms/DeployOperations for usage details.
##[error]Details:
##[error]BadRequest: {
"code": "UnsupportedRequestContent",
"message": "Request content is not well formed or supported."
}
##[error]Task failed while creating or updating the template deployment.
当我从模板中删除资源部分时,就没有问题了。
我认为您的问题出在您对自动缩放 arm 模板工作原理的理解上。这些应定义为顶级资源并引用它适用的资源。
您的模板应如下所示:
{
"type": "microsoft.insights/autoscalesettings",
"name": "[concat(variables('ServerFarm_gateway_name'),'-autoscaleout')]",
"apiVersion": "2015-04-01",
"location": "[resourceGroup().location]",
"properties": {
"profiles": [
{
"name": "Auto created scale condition 1",
"capacity": {
"minimum": "1",
"maximum": "5",
"default": "1"
}
}
],
"enabled": true,
"targetResourceUri": "[resourceId('Microsoft.Web/serverfarms', variables('ServerFarm_gateway_name'))]"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('ServerFarm_gateway_name'))]"
]
}