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.
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.
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.
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.
You are looking for clientAffinityEnabled
under properties
of your Microsoft.Web/sites
resource.
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'))]"
]
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With