Create or update an autoscale setting in Azure Monitor REST API

 

Updated: September 26, 2016

See Common headers and parameters for headers and parameters that are used by all requests related to autoscale settings.

Method

Request URI

PUT

https://management.azure.com/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/microsoft.insights/autoscaleSettings/{autoscale-setting-name}?api-version={api-version}

Replace {autoscale-setting-name} with the name of the autoscale setting for which you want to create or update.

{
  "name": "webfrontend-norapp-norapp",
  "type": "Microsoft.Insights/autoscaleSettings",
  "location": "East US",
  "tags": { },
  "properties": {
    "profiles": [ {
      "name": "Day",
      "capacity": {
        "minimum": "1",
        "maximum": "5",
        "default": "4"
      },
      "rules": [ {
        "metricTrigger": {
          "metricName": "Percentage CPU",
          "metricNamespace": "",
          "metricResourceUri": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/norapp/providers/microsoft.classicCompute/domainNames/norapp/availabilitySets/webfrontend",
          "timeGrain": "PT5M",
          "statistic": "Average",
          "timeWindow": "PT45M",
          "timeAggregation": "Average",
          "operator": "GreaterThanOrEqual",
          "threshold": 60
        },
        "scaleAction": {
          "direction": "Increase",
          "type": "ChangeCount",
          "value": "2",
          "cooldown": "PT20M"
        }
      } ],
      "recurrence": {
        "frequency": "Week",
        "schedule": {
          "timeZone": "Pacific Standard Time",
          "days": [
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday"
          ],
          "hours": [ 8 ],
          "minutes": [ 0 ]
        }
      }
    } ],
    "enabled": true,
    "name": "webfrontend-norapp-norapp",
    "targetResourceUri": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/norapp/providers/microsoft.classicCompute/domainNames/norapp/availabilitySets/webfrontend"
	"notifications": [
      {
        "operation": "Scale",
        "email": {
          "sendToSubscriptionAdministrator": false,
          "sendToSubscriptionCoAdministrators": false,
          "customEmails": [
              "user1@mycompany.com",
              "user2@mycompany.com"
              ]
        },
        "webhooks": [
          {
            "serviceUri": "https://foo.webhook.example.com?token=abcd1234",
            "properties": {
              "optional_key1": "optional_value1",
              "optional_key2": "optional_value2"
            }
          }
        ]
      }
    ]

  }
} 

Element Name

Required

Type

Description

name

Yes

String

The name of the autoscale setting.

type

Yes

String

Specifies that this is of type Microsoft.Insights/AutoscaleSettings

location

Yes

String

Specifies the supported Azure location of the autoscale setting. For more information, see List all of the available geo-locations.

tags

No

Complex Type

The tags and their values that are used by the autoscale setting.

profiles

Yes

Complex Type

Contains a collection of automatic scaling profiles that specify different scaling parameters for different time periods. A maximum of 20 profiles can be specified.

name

Yes

String

The name of the profile.

capacity

Yes

Complex Type

The number of instances that can be used during this profile.

rules

Yes

Complex Type

Contains a collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules can be specified.

metricTrigger

Yes

Complex Type

The trigger that results in a scaling action.

scaleAction

Yes

Complex Type

Specifies parameters for the scaling action.

fixedDate

No

Complex Type

A specific date for the profile. This element is not used if the Recurrence element is used.

recurrence

No

Complex Type

The repeating times at which this profile begins. This element is not used if the FixedDate element is used.

enabled

Yes

Boolean

Specifies whether automatic scaling is enabled for the resource.

targetResourceUri

Yes

String

The resource identifier of the resource that the autoscale setting should be added to.

Element name

Required

Type

Description

minimum

Yes

String

Specifies the minimum number of instances that are available for the scaling action.

maximum

Yes

String

Specifies the maximum number of instances that are available for the scaling action. The maximum number of instances is limited by the cores that are available in the subscription. You can use the to see the number of cores that are available in your subscription.

default

Yes

String

Specifies the number of instances that are available for scaling if metrics are not available for evaluation. The default is only used if the current instance count is lower than the default.

Element name

Required

Type

Description

metricName

Yes

String

The name of the metric that defines what the rule monitors.

metricResourceUri

Yes

String

The resource identifier of the resource the rule monitors.

timeGrain

Yes

Time

The granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute. ISO 8601 duration format.

statistic

Yes

String

How the metrics from multiple instances are combined. Possible values are:

  • Average

  • Min

  • Max

timeWindow

Yes

Time

The range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. ISO 8601 duration format.

timeAggregation

Yes

String

How the data that is collected should be combined over time. The default value is Average. Possible values are:

  • Average

  • Minimum

  • Maximum

  • Last

  • Total

  • Count

operator

Yes

String

The operator that is used to compare the metric data and the threshold. Possible values are:

  • Equals

  • NotEquals

  • GreaterThan

  • GreaterThanOrEqual

  • LessThan

  • LessThanOrEqual

threshold

Yes

Integer

The threshold of the metric that triggers the scale action.

Element name

Required

Type

Description

direction

Yes

String

Increase or decrease.

type

Yes

String

The type of action that should occur, this must be set to ChangeCount or PercentChangeCount.

value

Yes

String

The number that is involved in the scaling action. This value must be 1 or greater. The default value is 1.

cooldown

Yes

Time

The amount of time to wait since the last scaling action before this action occurs. Must be between 1 week and 1 minute. ISO 8601 duration format.

Element name

Required

Type

Description

timeZone

Yes

Time

The time zone of the start and end times for the profile.

start

Yes

Time

The start time for the profile.

end

Yes

Time

The end time for the profile.

Element name

Required

Type

Description

frequency

Yes

String

How often the schedule profile should take effect. This value must be Week, meaning each week will have the same set of profiles.

schedule

Yes

Complex Type

The scheduling constraints for when the profile begins.

timeZone

Yes

String

The time zone ID for the hours of the profile. See examples of acceptable Time Zone IDs below.

days

Yes

Collection

A collection of days that the profile takes effect on. Possible values are Sunday through Saturday.

hours

Yes

Collection

A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times are not supported)

minutes

Yes

Collection

A collection of minutes at which the profile takes effect at.

Acceptable time zone ID examples from International Dateline going east:

  1. Dateline Standard Time

  2. UTC-11

  3. Hawaiian Standard Time

  4. Alaskan Standard Time

  5. Pacific Standard Time (Mexico)

  6. Pacific Standard Time

  7. US Mountain Standard Time

  8. Mountain Standard Time (Mexico)

  9. Mountain Standard Time

  10. Central America Standard Time

  11. Central Standard Time

  12. Central Standard Time (Mexico)

  13. Canada Central Standard Time

  14. SA Pacific Standard Time

  15. Eastern Standard Time

  16. US Eastern Standard Time

  17. Venezuela Standard Time

  18. Paraguay Standard Time

  19. Atlantic Standard Time

  20. Central Brazilian Standard Time

  21. SA Western Standard Time

  22. Pacific SA Standard Time

  23. Newfoundland Standard Time

  24. E. South America Standard Time

  25. Argentina Standard Time

  26. SA Eastern Standard Time

  27. Greenland Standard Time

  28. Montevideo Standard Time

  29. Bahia Standard Time

  30. UTC-02

  31. Mid-Atlantic Standard Time

  32. Azores Standard Time

  33. Cape Verde Standard Time

  34. Morocco Standard Time

  35. UTC

  36. GMT Standard Time

  37. Greenwich Standard Time

  38. W. Europe Standard Time

  39. Central Europe Standard Time

  40. Romance Standard Time

  41. Central European Standard Time

  42. W. Central Africa Standard Time

  43. Namibia Standard Time

  44. Jordan Standard Time

  45. GTB Standard Time

  46. Middle East Standard Time

  47. Egypt Standard Time

  48. Syria Standard Time

  49. E. Europe Standard Time

  50. South Africa Standard Time

  51. FLE Standard Time

  52. Turkey Standard Time

  53. Israel Standard Time

  54. Kaliningrad Standard Time

  55. Libya Standard Time

  56. Arabic Standard Time

  57. Arab Standard Time

  58. Belarus Standard Time

  59. Russian Standard Time

  60. E. Africa Standard Time

  61. Iran Standard Time

  62. Arabian Standard Time

  63. Azerbaijan Standard Time

  64. Russia Time Zone 3

  65. Mauritius Standard Time

  66. Georgian Standard Time

  67. Caucasus Standard Time

  68. Afghanistan Standard Time

  69. West Asia Standard Time

  70. Ekaterinburg Standard Time

  71. Pakistan Standard Time

  72. India Standard Time

  73. Sri Lanka Standard Time

  74. Nepal Standard Time

  75. Central Asia Standard Time

  76. Bangladesh Standard Time

  77. N. Central Asia Standard Time

  78. Myanmar Standard Time

  79. SE Asia Standard Time

  80. North Asia Standard Time

  81. China Standard Time

  82. North Asia East Standard Time

  83. Singapore Standard Time

  84. W. Australia Standard Time

  85. Taipei Standard Time

  86. Ulaanbaatar Standard Time

  87. Tokyo Standard Time

  88. Korea Standard Time

  89. Yakutsk Standard Time

  90. Cen. Australia Standard Time

  91. AUS Central Standard Time

  92. E. Australia Standard Time

  93. AUS Eastern Standard Time

  94. West Pacific Standard Time

  95. Tasmania Standard Time

  96. Magadan Standard Time

  97. Vladivostok Standard Time

  98. Russia Time Zone 10

  99. Central Pacific Standard Time

  100. Russia Time Zone 11

  101. New Zealand Standard Time

  102. UTC+12

  103. Fiji Standard Time

  104. Kamchatka Standard Time

  105. Tonga Standard Time

  106. Samoa Standard Time

  107. Line Islands Standard Time

Field

Description

operation

value must be "Scale"

sendToSubscriptionAdministrator

value must be "true" or "false"

sendToSubscriptionCoAdministrator

value must be "true" or "false"

customEmails

value can be null [] or string array of emails

webhooks

can be null or valid Uri

serviceUri

a valid HTTPS Uri

properties

value must be empty {} or can contain key-value pairs

Status code: 200

{

  "id": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/norapp/providers/microsoft.insights/autoscalesettings/webfrontend-norapp-norapp",
  "name": "webfrontend-norapp-norapp",
  "type": "Microsoft.Insights/autoscaleSettings",
  "location": "East US",
  "tags": { },
  "properties": {
    "profiles": [ {
      "name": "Day",
      "capacity": {
        "minimum": "1",
        "maximum": "5",
        "default": "4"
      },
      "rules": [ {
        "metricTrigger": {
          "metricName": "Percentage CPU",
          "metricNamespace": "",
          "metricResourceUri": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/norapp/providers/microsoft.classicCompute/domainNames/norapp/availabilitySets/webfrontend",
          "timeGrain": "PT5M",
          "statistic": "Average",
          "timeWindow": "PT45M",
          "timeAggregation": "Average",
          "operator": "GreaterThanOrEqual",
          "threshold": 60
        },
        "scaleAction": {
          "direction": "Increase",
          "type": "ChangeCount",
          "value": "2",
          "cooldown": "PT20M"
        }
      } ],
      "recurrence": {
        "frequency": "Week",
        "schedule": {
          "timeZone": "Pacific Standard Time",
          "days": [
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday",
            "Friday"
          ],
          "hours": [ 8 ],
          "minutes": [ 0 ]
        }
      }
    } ],
    "enabled": true,
    "name": "webfrontend-norapp-norapp",
    "targetResourceUri": "/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/norapp/providers/microsoft.classicCompute/domainNames/norapp/availabilitySets/webfrontend"
	"notifications": [
      {
        "operation": "Scale",
        "email": {
          "sendToSubscriptionAdministrator": false,
          "sendToSubscriptionCoAdministrators": false,
          "customEmails": [
              "user1@mycompany.com",
              "user2@mycompany.com"
              ]
        },
        "webhooks": [
          {
            "serviceUri": "https://foo.webhook.example.com?token=abcd1234",
            "properties": {
              "optional_key1": "optional_value1",
              "optional_key2": "optional_value2"
            }
          }
        ]
      }
    ]

  }
} 

Show: