{
"$schema": "https://<span class=" active-doc-0" data-doc-items="0">schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json[1](#doc-pos=0)</span>#",
"contentVersion": "1.0.0.0",
"parameters": {
"webAppName": {
"type": "string",
"metadata": {
"description": "The name of the Web App."
}
},
"resourceGroupName": {
"type": "string",
"metadata": {
"description": "The name of the resource group."
}
}
},
"resources": [
{
"type": "Microsoft.Insights/autoscaleSettings",
"apiVersion": "2022-10-01",
"name": "[concat(parameters('webAppName'), '-autoscale')]",
"location": "eastus",
"properties": {
"profiles": [
{
"name": "Default",
"capacity": {
"minimum": "1",
"maximum": "10",
"default": "1"
},
"rules": [
{
"metricTrigger": {
"metricName": "Percentage CPU",
"metricNamespace": "Microsoft.Web/serverfarms",
"metricResourceUri": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverfarms/', parameters('webAppName'))]",
"timeGrain": "PT1M",
"statistic": "Average",
"timeWindow": "PT5M",
"timeAggregation": "Average",
"operator": "GreaterThan",
"threshold": "85"
},
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT5M"
}
}
]
}
]
}
}
]
}
You can use this ARM template to create an Autoscale Setting for your Web App. You will need to provide the webAppName
and resourceGroupName
parameters when deploying the template.
This template creates an Autoscale Setting with a single profile named "Default". The profile has a capacity range of 1 to 10 instances, with a default of 1 the profile also has a single rule that triggers a scale up action if the CPU usage is above 85% for more than 5 minutes. The scale up action increases the instance count by 1 and has a cooldown period of 5 minutes.