Autoscale Settings

Overview

The Autoscale Setting builder is used to create Autoscale settings to control how the Azure Monitor Autoscale can increase and decrease the capacity of some resources, such as Virtual Machine Scale Sets.

  • Autoscale Notification Email Builder (autoscaleNotificationEmail)
  • Autoscale Webhook Builder (autoscaleWebhook)
  • Autoscale Notification Builder (autoscaleNotification)
  • Autoscale Capacity Builder (autoscaleCapacity)
  • Autoscale Schedule Builder (autoscaleSchedule)
  • Autoscale Dimension Builder (autoscaleDimension)
  • Autoscale Scale Action Builder (scaleAction)
  • Autoscale Recurrence Builder (recurrence)
  • Autoscale Predictive Autoscale Policy Builder (predictiveAutoscalePolicy)
  • Autoscale Fixed Date Builder (fixedDate)
  • Autoscale Metric Trigger Builder (autoscaleMetricTrigger)
  • Autoscale Rule Builder (autoscaleRule)
  • Autoscale Profile Builder (autoscaleProfile)
  • Autoscale Settings Properties Builder (autoscaleSettingsProperties)
  • Autoscale Settings Builder (autoscaleSettings) - builds Microsoft.Insights/autoscalesettings

NotificationEmailBuilder Keywords

The NotificationEmailBuilder constructs Email Notifications.

KeywordPurpose
custom_emailsSets custom emails for notifications.
send_to_subscription_administratorSends notifications to the subscription administrator.
send_to_subscription_co_administratorsSends notifications to the subscription co-administrators.

WebhookBuilder Keywords

The WebhookBuilder constructs Webhooks.

KeywordPurpose
propertiesSets properties for the webhook.
service_uriSets the service URI for the webhook.

NotificationBuilder Keywords

The NotificationBuilder constructs Notifications.

KeywordPurpose
emailSets email notifications.
webhooksSets webhook notifications.

CapacityBuilder Keywords

The CapacityBuilder constructs Capacity configurations.

KeywordPurpose
defaultSets the default capacity value.
maximumSets the maximum capacity value.
minimumSets the minimum capacity value.

ScheduleBuilder Keywords

The ScheduleBuilder constructs Schedules.

KeywordPurpose
daysSets the days for the schedule.
hoursSets the hours for the schedule.
minutesSets the minutes for the schedule.
timeZoneSets the time zone for the schedule.

DimensionBuilder Keywords

The DimensionBuilder constructs Dimensions.

KeywordPurpose
dimensionNameSets the name of the dimension.
operatorSets the operator for the dimension.
valuesSets values for the dimension.

ScaleActionBuilder Keywords

The ScaleActionBuilder constructs Scale Actions.

KeywordPurpose
cooldownSets the cooldown for the scale action.
directionSets the direction for the scale action.
action_typeSets the type of action for the scale action.
valueSets the value for the scale action.

RecurrenceBuilder Keywords

The RecurrenceBuilder constructs Recurrence configurations.

KeywordPurpose
frequencySets the frequency for the recurrence.
scheduleSets the schedule for the recurrence.

PredictiveAutoscalePolicyBuilder Keywords

The PredictiveAutoscalePolicyBuilder constructs Predictive Autoscale Policies.

KeywordPurpose
scale_look_ahead_timeSets the scale look-ahead time for the policy.
scale_modeSets the scale mode for the policy.

FixedDateBuilder Keywords

The FixedDateBuilder constructs Fixed Date configurations.

KeywordPurpose
endSets the end date for the fixed date.
startSets the start date for the fixed date.
time_zoneSets the time zone for the fixed date.

MetricTriggerBuilder Keywords

The MetricTriggerBuilder constructs Metric Triggers.

KeywordPurpose
dimensionsSets dimensions for the metric trigger.
divide_per_instanceDivides per instance for the metric trigger.
metric_nameSets the metric name for the metric trigger.
metric_namespaceSets the metric namespace for the metric trigger.
metric_resource_locationSets the metric resource location for the metric trigger.
metric_resource_uriSets the metric resource URI for the metric trigger.
operatorSets the operator for the metric trigger.
statisticSets the statistic for the metric trigger.
thresholdSets the threshold for the metric trigger.
time_aggregationSets the time aggregation for the metric trigger.
time_grainSets the time grain for the metric trigger.
time_windowSets the time window for the metric trigger.

RuleBuilder Keywords

The RuleBuilder constructs Rules.

KeywordPurpose
metric_triggerSets the metric trigger for the rule.
scale_actionSets the scale action for the rule.

ProfileBuilder Keywords

The ProfileBuilder constructs Profiles.

KeywordPurpose
capacitySets the capacity for the profile.
fixed_dateSets the fixed date for the profile.
nameSets the name for the profile.
recurrenceSets the recurrence for the profile.
rulesSets the rules for the profile.

AutoscaleSettingsPropertiesBuilder Keywords

The AutoscaleSettingsPropertiesBuilder constructs Autoscale Settings Properties.

KeywordPurpose
enabledSets the enabled state for autoscale settings.
nameSets the name for autoscale settings.
notificationsSets notifications for autoscale settings.
predictive_autoscale_policySets the predictive autoscale policy for autoscale settings.
profilesSets profiles for autoscale settings.
target_resource_locationSets the target resource location for autoscale settings.
target_resource_uriSets the target resource URI for autoscale settings.

AutoscaleSettingsBuilder Keywords

The AutoscaleSettingsBuilder constructs Autoscale Settings.

KeywordPurpose
nameSets the name for autoscale settings.
locationSets the location for autoscale settings.
propertiesSets properties for autoscale settings.

Example

This will define autoscale settings for a VM scale set.

vmss {
    name "my-vmss"
    vm_profile (
        vm {
            vm_size Vm.Standard_B1s
            username "azureuser"
            operating_system Vm.UbuntuServer_2204LTS
            os_disk 30 Vm.Premium_LRS
            no_data_disk
            custom_script "apt update && apt install -y stress"
        }
    )
    autoscale (
        autoscaleSettings {
            name "my-vmss-autoscale"
            properties (
                autoscaleSettingsProperties {
                    profiles [
                        autoscaleProfile {
                            capacity (
                                autoscaleCapacity {
                                    maximum 10
                                }
                            )
                            rules [ // Two rules, one for scaling out and one for scaling in.
                                autoscaleRule { // Scale up with CPU > 60 across the scale set
                                    metric_trigger (
                                        autoscaleMetricTrigger {
                                            metric_name "Percentage CPU"
                                            divide_per_instance true
                                            operator MetricTriggerOperator.GreaterThan
                                            statistic MetricTriggerStatistic.Average
                                            threshold 60
                                            time_aggregation MetricTriggerTimeAggregation.Average
                                            time_grain (TimeSpan.FromMinutes 5)
                                            time_window (TimeSpan.FromMinutes 10)
                                        }
                                    )
                                    scale_action (
                                        scaleAction {
                                            cooldown (TimeSpan.FromMinutes 10)
                                            direction ScaleActionDirection.Increase
                                            action_type ScaleActionType.ChangeCount
                                            value 2
                                        }
                                    )
                                }
                                autoscaleRule { // Scale down with CPU < 20 across the scale set
                                    metric_trigger (
                                        autoscaleMetricTrigger { // Leaving most defaults
                                            metric_name "Percentage CPU"
                                            divide_per_instance true
                                            operator MetricTriggerOperator.LessThan
                                            threshold 20
                                        }
                                    )
                                    scale_action (
                                        scaleAction { // Leaving most defaults
                                            direction ScaleActionDirection.Decrease
                                        }
                                    )
                                }
                            ]
                        }
                    ]
                }
            )
        }
    )
}