Share via

Could someone to help me with 'Microsoft.Insights/autoscalesettings@2022-10-01' ?

Sandor Debnar 0 Reputation points
2023-09-25T08:31:31.65+00:00

Hi,
i would like to deploy some Autoscale Settings for my Web App but i am struggling with the Template.
Could someone to help me with that? Thanks

Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bryan Trach 17,842 Reputation points Microsoft Employee Moderator
    2023-09-26T01:37:47.8+00:00

    @Sandor Debnar

    {
      "$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.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.