Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling ARR Affinity using ARM Template

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.

like image 831
disco Avatar asked Feb 03 '17 10:02

disco


People also ask

What does ARR affinity do when enabled?

I understand that ARR affinity cookie pairs a client request to a specific server. And if it is enabled, then the requests will always go only to the server tied to the Affinity cookie.

What is ARR affinity cookie?

As discussed at Disable Session affinity cookie (ARR cookie) for Azure web apps - Azure App Service, ARRAffinity cookie is a built-in feature of Azure App Service to facilitate session data management. Today we would like to study a typical case to help those concerned to avoid potential business impact.

What is ARR affinity In Azure?

ARR cleverly identifies the user by assigning them a special cookie (known as an affinity cookie), which allows the service to choose the right instance the user was using to serve subsequent requests made by that user.


2 Answers

You are looking for clientAffinityEnabled under properties of your Microsoft.Web/sites resource.

like image 195
Martin Brandl Avatar answered Oct 21 '22 06:10

Martin Brandl


Below is a fully tested working ARM Template which deploy a Azure Web App with "ARR Affinity" set to OFF after deployed successfully.

Useful reference: Disable Session affinity cookie (ARR cookie) for Azure web apps

{
  "$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'))]"
      ]
    }
  ]
}
like image 28
juvchan Avatar answered Oct 21 '22 07:10

juvchan