Share via


Update Autoscale Settings

 

The Update Autoscale Settings operation can be used to update automatic scaling settings for deployments of Cloud Services, Virtual Machines, Websites, and Mobile Services.

Request

The Update Autoscale Settings request may be specified as follows. Replace <subscription-id> with the subscription ID.

Method

Request URI

PUT

https://management.core.windows.net/<subscription-id>/services/monitoring/autoscalesettings

You must make sure that the request that is made to the management service is secure. For additional details, see Authenticating Service Management Requests.

URI Parameters

The following table lists the parameter to use for a cloud service that has web roles or worker roles deployed to it. Replace <cloudservice> with the name of the cloud service, <deployment-slot> with staging or production, and <role> with the name of the role. The parameter is case-sensitive.

URI Parameter

Description

resourceId=/hostedservices/<cloudservice>/deploymentslots/<deployment-slot>/roles/<role>

Required. Specifies that the automatic scaling settings should be updated for a role in the production or staging deployment environments for the specified cloud service. For more information about finding the names of cloud services in your subscription, see List Hosted Services. For more information about finding role names, see Get Deployment.

The following table lists the parameter to use for a cloud service that has Virtual Machines deployed to it. Replace <cloudservice> with the name of the cloud service and <availability-set> with the name of the availability set in which the Virtual Machines are a member.

URI Parameter

Description

resourceId=/virtualmachines/<cloudservice>/availabilitySets/<availability-set>

Required. Specifies that the automatic scaling settings should be updated for an availability set of Virtual Machines. For more information about finding the name of an availability set in which a Virtual Machine is a member, see Get Deployment.

The following table lists the parameter to use for Websites. Replace <webspace> with the name of the webspace and replace <serverfarm> with the name of the server farm in that webspace.

URI Parameter

Description

resourceId=/webspaces/<webspace>/serverFarms/<serverfarm>

Required. Specifies that the automatic scaling settings should be updated for a server farm in a webspace. For more information about finding the names of webspaces, see List Webspaces. For more information about finding the names of server farms, see Create, Manage, or Delete a Server Farm.

The following table lists the parameter to use for Mobile Services. Replace <mobileservice> with the name of the Mobile Service.

URI Parameter

Description

resourceId=/mobileservices/<mobileservice>

Required. Specifies that the automatic scaling settings should be updated for a Mobile Service.

Request Headers

The following table describes the request headers.

Request Header

Description

Content-Type

Required. Set this header to application/xml.

x-ms-version

Required. Specifies the version of the operation to use for this request. This header should be set to 2013-10-01 or higher. For more information about versioning headers, see Service Management Versioning.

Request Body

The format of the request body is as follows:

{
  "Profiles": [
    {
      "Name": "name-of-profile",
      "Capacity": {
        "Minimum": "<minimum-number-of-instances>",
        "Maximum": "<maximum-number-of-instances>",
        "Default": "<default-number-of-instances>"
      },
      "Rules": [
        {
          "MetricTrigger": {
            "MetricName": "<name-of-trigger>",
            "MetricNamespace": "<identifier-of-namespace>",
            "MetricSource": "<deployment-resource>",
            "TimeGrain": "<data-collection-time>",
            "Statistic": "<evaluation-of-instances>",
            "TimeWindow": "<range-of-data-collection>",
            "TimeAggregation": "<aggregation-of-data>",
            "Operator": "<data-collection-operator>",
            "Threshold": <usage-amount>
          },
          "ScaleAction": {
            "Direction": "<direction-of-action>",
            "Type": "<type-of-action>",
            "Value": "<size-of-action>",
            "Cooldown": "<time-of-action>"
          },
        },  
      ],
      "Recurrence": {
        "Frequency": "<frequency-of-action>",
        "Schedule": {
          "TimeZone": "<time-zone>",
          "Days": [<days-of-the-week>],
          "Hours": [<number-of-hours>],
          "Minutes": [<number-of-minutes>]
        }
      },
      "FixedDate": {
        "Start": "<start-time-of-action>",
        "End": "<end-time-of-action>",
        "TimeZone": "<time-zone>"
      }
    }
  ],
  "Enabled": <enable-scaling>
}

The following table describes the elements of the request body.

Element name

Description

Profiles

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

Enabled

Required. Specifies whether automatic scaling is enabled for the specified role.

Possible values are:

  • true

  • false

Profiles

Contains a collection of automatic scaling profiles that specify different scaling parameters for different time periods.

Element name

Description

Name

Required. Specifies the name of the profile.

Capacity

Required. Specifies the number of instances that can be used in the scaling action.

Rules

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

Recurrence

Optional. Specifies the frequency and schedule for the scaling action. This element is not used if the FixedDate element is used.

FixedDate

Optional. Specifies a specific date for the scaling action. This element is not used if the Recurrence element is used.

Capacity

Specifies the number of instances that can be used in the scaling action.

Element name

Description

Minimum

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

Maximum

Required. 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 classic portal to see the number of cores that are available in your subscription.

Default

Required. 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.

Rules

Contains a collection of rules that provide the triggers and parameters for the scaling action.

Element name

Description

MetricTrigger

Required. Specifies the metrics that are used to determine when a scaling action occurs.

ScaleAction

Required. Specifies parameters for the scaling action.

MetricTrigger

Specifies the metrics that are used to determine when a scaling action occurs.

Element name

Description

MetricName

Required. Specifies the name of the trigger.

MetricNamespace

Required. Specifies a namespace identifier for the service in which the deployment is running. You can use the Microsoft.WindowsAzure.Management.Monitoring.Metrics APIs to obtain the available metric namespace identifiers.

MetricSource

Required. Specifies the path to the resource to use for scaling by metrics.

The following format is used to define the resource path for cloud services:

/CloudService/<cloud-service>/<deployment-slot>/<role>

Replace <cloud-service> with the name of the cloud service, <deployment-slot> with production or staging depending on the environment in which the deployment is running, and <role> with the name of the role.

The following format is used to define the resource path for scaling by the depth of a queue:

/Storage/<storage-account>/Queue/<queue>

The following format is used to define the resource path for scaling by metrics that are available in the classic portal for storage accounts:

/Storage/ServiceMetric/<storage-account>/<storage-service>

The following format is used to define the resource path for scaling by the return value of an API:

/Storage/APIMetric/<storage-account>/<storage-service>/<api>

For all storage resource paths, replace <storage-account> with the name of the storage account where the resource is located. Where appropriate, replace <queue> with the name of the queue or replace <storage-service> with table, queue, or blob depending on your needs.

The following format is used to define the resource path for deployments of Service Bus:

/ServiceBus/<servicebus-namespace>/<resource-type>/<entity>

Replace <servicebus-namespace> with the namespace of the service bus. Replace <resource-type> with queue, topics, or notificationhubs depending on your needs. Replace <entity> with the name of the service bus entity.

The following format is used to define the resource path for deployments of Virtual Machines:

/VirtualMachinesAvailabilitySet/<cloud-service>/<availability-set>

Replace <cloud-service> with the name of the cloud service, and <availability-set> with the name of the availability set.

The following format is used to define the resource path for a server that is running a website:

/WebsiteDedicated/<webspace>/DefaultServerFarm

The following format is used to define the resource path for a logical web application:

/Website/<webspace>/<website>

Replace <webspace> with the name of the webspace that contains the websites, and <website> with the name of the website.

The following format is used to define the resource path for deployments of Mobile Services:

/MobileService/<mobile-service>

Replace <mobile service> with the name of the mobile service.

TimeGrain

Required. Specifies the frequency of data collection. Typically, this is set to 5 minutes (PT5M).

Statistic

Required. Specifies how the metrics from multiple instances are combined.

Possible values are:

  • Average

  • Min

  • Max

TimeWindow

Required. Specifies the range of time in which instance data is collected.

The default value is PT45M.

TimeAggregation

Required. Specifies how the data that is collected should be combined over time.

Possible values are:

  • Average

  • Minimum

  • Maximum

  • Last

  • Total

  • Count

The default value is Average.

Operator

Required. Specifies the operator that is used to evaluate the metric.

Possible values are:

  • Equals

  • NotEquals

  • GreaterThan

  • GreaterThanOrEqual

  • LessThan

  • LessThanOrEqual

Threshold

Required. Specifies the percentage of usage that triggers the scaling operation.

ScaleAction

Specifies parameters for the scaling action.

Element name

Description

Direction

Required. Specified whether the scaling action increases or decreases the number of instances that are used.

Possible values are:

  • Increase

  • Decrease

A default profile has 2 rules, one for increasing instances and one for decreasing instances.

Type

Required. Specifies the type of action that should occur.

Currently, this must be set to ChangeCount.

Value

Required. Specifies the number of instances that are involved in the scaling action. This value must be 1 or greater. The default size is 1.

Cooldown

Required. Specifies the number of minutes to wait between the last scaling action and the next scale action.

The default value is PT20M.

Recurrence

Specifies the frequency and schedule for the scaling action.

Element name

Description

Frequency

Required. Specifies how often the scaling action should occur. This value must be Week.

Schedule

Required. Specifies the scheduling constraints of the scaling action.

FixedDate

Specifies a specific date for the scaling action.

Element name

Description

TimeZone

Required. Specifies the time zone for the scaling action.

Start

Required. Specifies the start time of the scaling action.

End

Required. Specifies the end time of the scaling action.

Schedule

Specifies the scheduling constraints of the scaling action.

Element name

Description

TimeZone

Required. Specifies the time zone for the schedule parameters.

Days

Required. Specifies a comma separated list of the days of in schedule.

Possible values are:

  • Monday

  • Tuesday

  • Wednesday

  • Thursday

  • Friday

  • Saturday

  • Sunday

Hours

Required. Specifies the hours when the schedule should run.

Minutes

Required. Specifies the minutes of the hour when the schedule should run. Only one value is supported for this element. You can only schedule an action for once per hour.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

A successful operation returns status code 200 (OK). For information about status codes, see Service Management Status and Error Codes.

Response Headers

The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Header

Description

x-ms-request-id

A value that uniquely identifies a request made against the management service.

Response Body

None.

Remarks

You can also use the classic portal to update the settings for automatic scaling of your application. For more information, see How to Scale an Application.