Azure ARM模板-如何扩展到正好2个实例?

问题描述

我想扩展到特定的实例数。

我的模板中包含以下内容:

{
  "type": "Microsoft.Web/serverfarms","apiVersion": "2018-02-01","name": "[parameters('name')]","location": "[variables('location')]","sku": {
    "name": "[parameters('sku_name')]","capacity": "[parameters('sku_capacity')]"
  },"kind": "app","properties": {
    "perSiteScaling": false,"maximumElasticWorkerCount": 1,"isSpot": false,"reserved": false,"isXenon": false,"hyperV": false,"targetWorkerCount": 0,"targetWorkerSizeId": 0
  }
}

sku_capacity设置为2,但不起作用。没有任何效果。如何正确配置呢?

此外,如果我在Azure界面中设置了此设置并导出模板,则似乎不包括自动缩放设置。为什么?

解决方法

capacity更改不会生效的一种情况是,您的应用服务计划所在的Pricing tier不支持向外扩展。

我有一个标准的应用程序服务计划,以下模板对我来说很有效:

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#","contentVersion": "1.0.0.0","parameters": {
        "asp_name": {
            "defaultValue": "ASPResources","type": "String"
        },"sku_capacity": {
            "defaultValue": 5,"type": "int"
        }
    },"variables": {},"resources": [
        {
            "type": "Microsoft.Web/serverfarms","apiVersion": "2018-02-01","name": "[parameters('asp_name')]","location": "South India","sku": {
                "name": "S1","tier": "Standard","size": "S1","family": "S","capacity": "[parameters('sku_capacity')]"
            },"kind": "app","properties": {
                "perSiteScaling": false,"maximumElasticWorkerCount": 1,"isSpot": false,"reserved": false,"isXenon": false,"hyperV": false,"targetWorkerCount": 0,"targetWorkerSizeId": 0
            }
        }
    ]
}

其他资源:App Service limits

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...