I need to Create ARM Template to enable Auto healing in Azure App service with Custom Auto healing based on HTTP status code range (400-530) and recycle the App service if the request count is reached for the specified status codes and specified time limit. I couldn't find ARM template config for status code range and I am able to see only for single status code. Can someone pls help me in finding the right config to mention the status code range and tell me how the below has to be configured.
"type": "Microsoft.Web/sites/config", "apiVersion": "2018-11-01", "name": "[concat(parameters('sites_SampleAutoHeal_name'), '/web')]", "location": "West Europe", "dependsOn": [ "[resourceId('Microsoft.Web/sites', parameters('sites_SampleAutoHeal_name'))]" ], ..... "autoHealEnabled": true, "autoHealRules": { "triggers": { "privateBytesInKB": 0, "statusCodes": [], "slowRequests": {} }, "actions": { "actionType": "Recycle", "minProcessExecutionTime": "00:00:00" } },
OK, I don't know if this is going to solve your issue. I'll post what I have and then explain:
"autoHealEnabled": true,
"autoHealRules": {
"triggers": {
"requests": null,
"privateBytesInKB": 0,
"statusCodes": [],
"statusCodesRange": [
{
"statusCodes": "500-530",
"path": "",
"count": 10,
"timeInterval": "00:02:00"
}
],
"slowRequests": null,
"slowRequestsWithPath": []
},
"actions": {
"actionType": 0,
"customAction": null,
"minProcessExecutionTime": "00:00:00"
}
},
Here's what I did:
Bottom line? I think you could try this. It might work. I'm not convinced this is completely wired into ARM in a standard way, and it may be possible that it has to be done by API.
Edit: I just verified in Postman that https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups/{{resourceGroupName}}/providers/Microsoft.Web/sites/{{appServiceName}}/config/web?api-version=2015-08-01 returns the auto-heal settings. So, it's probable that if ARM templates aren't doing the trick you might be able to do this with the API.
Edit: So, I used $app = Get-AzWebApp ... on an app service where I had this set up, and $app.SiteConfig.AutoHealRules.Triggers only includes Requests, PrivateBytesInKB, StatusCodes (not range), and SlowRequests. So, using Set-AzWebApp looks like it's not ready for that yet.
You could try something like this - it's not debugged:
$props = @{
autoHealEnabled = $true
autoHealRules = @{
triggers = @{
requests = $null
privateBytesInKB = 0
statusCodes = @()
statusCodesRange = @(
{
statusCodes = "500-530"
path = ""
count = 10
timeInterval = "00:02:00"
}
)
slowRequests = $null
slowRequestsWithPath = @()
}
actions = @{
actionType = 0
customAction = $null
minProcessExecutionTime = "00:00:00"
}
}
}
Set-AzResource -$props -ResourceGroupName "YourResourceGroup" -ResourceName "YourAppServiceName/web" -ResourceType "Microsoft.Web/sites/config"
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