9

I want to configure the app-setting "ARR Affinity" to be turned off when provisioning a new app service via our ARM template. How do I do this?

I can not find anything about this, which kind of indicates that there currently is no support for it yet.

4

2 回答 2

12

clientAffinityEnabled您正在寻找properties您的Microsoft.Web/sites资源。

于 2017-02-03T10:56:20.460 回答
8

下面是一个经过全面测试的工作 ARM 模板,它在部署成功后部署了一个“ ARR Affinity ”设置为OFF的 Azure Web 应用程序。

有用的参考:禁用 Azure Web 应用的会话关联 cookie (ARR cookie)

{
  "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]"
    },
    "hostingplan.name": {
      "type": "string",
      "defaultValue": "[concat(resourceGroup().name, '-hp')]"
    },
    "webapp.name": {
      "type": "string",
      "defaultValue": "[resourceGroup().name]"
    }
  },
  "resources": [
    {
      "type": "Microsoft.Web/serverfarms",
      "name": "[parameters('hostingplan.name')]",
      "apiVersion": "2016-09-01",
      "sku": {
        "name": "S1",
        "capacity": 1
      },
      "properties": {
        "name": "[parameters('hostingplan.name')]"
      },
      "location": "[parameters('location')]"
    },
    {
      "type": "Microsoft.Web/sites",
      "name": "[parameters('webapp.name')]",
      "apiVersion": "2016-08-01",
      "properties": {
        "clientAffinityEnabled": false,
        "serverFarmId": "[resourceId('Microsoft.Web/serverfarms', parameters('hostingplan.name'))]"
      },
      "location": "[parameters('location')]",
      "dependsOn": [
        "[resourceId('Microsoft.Web/serverfarms', parameters('hostingplan.name'))]"
      ]
    }
  ]
}
于 2017-02-03T13:40:07.810 回答