We recommend using Azure Native.
azure.monitoring.AutoscaleSetting
Explore with Pulumi AI
Manages a AutoScale Setting which can be applied to Virtual Machine Scale Sets, App Services and other scalable resources.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "autoscalingTest",
location: "West Europe",
});
const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
name: "acctvn",
addressSpaces: ["10.0.0.0/16"],
location: example.location,
resourceGroupName: example.name,
});
const exampleSubnet = new azure.network.Subnet("example", {
name: "acctsub",
resourceGroupName: example.name,
virtualNetworkName: exampleVirtualNetwork.name,
addressPrefixes: ["10.0.2.0/24"],
});
const exampleLinuxVirtualMachineScaleSet = new azure.compute.LinuxVirtualMachineScaleSet("example", {
name: "exampleset",
location: example.location,
resourceGroupName: example.name,
upgradeMode: "Manual",
sku: "Standard_F2",
instances: 2,
adminUsername: "myadmin",
adminSshKeys: [{
username: "myadmin",
publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
}],
networkInterfaces: [{
name: "TestNetworkProfile",
primary: true,
ipConfigurations: [{
name: "TestIPConfiguration",
primary: true,
subnetId: exampleSubnet.id,
}],
}],
osDisk: {
caching: "ReadWrite",
storageAccountType: "StandardSSD_LRS",
},
sourceImageReference: {
publisher: "Canonical",
offer: "0001-com-ubuntu-server-jammy",
sku: "22_04-lts",
version: "latest",
},
});
const exampleAutoscaleSetting = new azure.monitoring.AutoscaleSetting("example", {
name: "myAutoscaleSetting",
resourceGroupName: example.name,
location: example.location,
targetResourceId: exampleLinuxVirtualMachineScaleSet.id,
profiles: [{
name: "defaultProfile",
capacity: {
"default": 1,
minimum: 1,
maximum: 10,
},
rules: [
{
metricTrigger: {
metricName: "Percentage CPU",
metricResourceId: exampleLinuxVirtualMachineScaleSet.id,
timeGrain: "PT1M",
statistic: "Average",
timeWindow: "PT5M",
timeAggregation: "Average",
operator: "GreaterThan",
threshold: 75,
metricNamespace: "microsoft.compute/virtualmachinescalesets",
dimensions: [{
name: "AppName",
operator: "Equals",
values: ["App1"],
}],
},
scaleAction: {
direction: "Increase",
type: "ChangeCount",
value: 1,
cooldown: "PT1M",
},
},
{
metricTrigger: {
metricName: "Percentage CPU",
metricResourceId: exampleLinuxVirtualMachineScaleSet.id,
timeGrain: "PT1M",
statistic: "Average",
timeWindow: "PT5M",
timeAggregation: "Average",
operator: "LessThan",
threshold: 25,
},
scaleAction: {
direction: "Decrease",
type: "ChangeCount",
value: 1,
cooldown: "PT1M",
},
},
],
}],
predictive: {
scaleMode: "Enabled",
lookAheadTime: "PT5M",
},
notification: {
email: {
sendToSubscriptionAdministrator: true,
sendToSubscriptionCoAdministrator: true,
customEmails: ["admin@contoso.com"],
},
},
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="autoscalingTest",
location="West Europe")
example_virtual_network = azure.network.VirtualNetwork("example",
name="acctvn",
address_spaces=["10.0.0.0/16"],
location=example.location,
resource_group_name=example.name)
example_subnet = azure.network.Subnet("example",
name="acctsub",
resource_group_name=example.name,
virtual_network_name=example_virtual_network.name,
address_prefixes=["10.0.2.0/24"])
example_linux_virtual_machine_scale_set = azure.compute.LinuxVirtualMachineScaleSet("example",
name="exampleset",
location=example.location,
resource_group_name=example.name,
upgrade_mode="Manual",
sku="Standard_F2",
instances=2,
admin_username="myadmin",
admin_ssh_keys=[{
"username": "myadmin",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
}],
network_interfaces=[{
"name": "TestNetworkProfile",
"primary": True,
"ip_configurations": [{
"name": "TestIPConfiguration",
"primary": True,
"subnet_id": example_subnet.id,
}],
}],
os_disk={
"caching": "ReadWrite",
"storage_account_type": "StandardSSD_LRS",
},
source_image_reference={
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts",
"version": "latest",
})
example_autoscale_setting = azure.monitoring.AutoscaleSetting("example",
name="myAutoscaleSetting",
resource_group_name=example.name,
location=example.location,
target_resource_id=example_linux_virtual_machine_scale_set.id,
profiles=[{
"name": "defaultProfile",
"capacity": {
"default": 1,
"minimum": 1,
"maximum": 10,
},
"rules": [
{
"metric_trigger": {
"metric_name": "Percentage CPU",
"metric_resource_id": example_linux_virtual_machine_scale_set.id,
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT5M",
"time_aggregation": "Average",
"operator": "GreaterThan",
"threshold": 75,
"metric_namespace": "microsoft.compute/virtualmachinescalesets",
"dimensions": [{
"name": "AppName",
"operator": "Equals",
"values": ["App1"],
}],
},
"scale_action": {
"direction": "Increase",
"type": "ChangeCount",
"value": 1,
"cooldown": "PT1M",
},
},
{
"metric_trigger": {
"metric_name": "Percentage CPU",
"metric_resource_id": example_linux_virtual_machine_scale_set.id,
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT5M",
"time_aggregation": "Average",
"operator": "LessThan",
"threshold": 25,
},
"scale_action": {
"direction": "Decrease",
"type": "ChangeCount",
"value": 1,
"cooldown": "PT1M",
},
},
],
}],
predictive={
"scale_mode": "Enabled",
"look_ahead_time": "PT5M",
},
notification={
"email": {
"send_to_subscription_administrator": True,
"send_to_subscription_co_administrator": True,
"custom_emails": ["admin@contoso.com"],
},
})
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/monitoring"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("autoscalingTest"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
Name: pulumi.String("acctvn"),
AddressSpaces: pulumi.StringArray{
pulumi.String("10.0.0.0/16"),
},
Location: example.Location,
ResourceGroupName: example.Name,
})
if err != nil {
return err
}
exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
Name: pulumi.String("acctsub"),
ResourceGroupName: example.Name,
VirtualNetworkName: exampleVirtualNetwork.Name,
AddressPrefixes: pulumi.StringArray{
pulumi.String("10.0.2.0/24"),
},
})
if err != nil {
return err
}
exampleLinuxVirtualMachineScaleSet, err := compute.NewLinuxVirtualMachineScaleSet(ctx, "example", &compute.LinuxVirtualMachineScaleSetArgs{
Name: pulumi.String("exampleset"),
Location: example.Location,
ResourceGroupName: example.Name,
UpgradeMode: pulumi.String("Manual"),
Sku: pulumi.String("Standard_F2"),
Instances: pulumi.Int(2),
AdminUsername: pulumi.String("myadmin"),
AdminSshKeys: compute.LinuxVirtualMachineScaleSetAdminSshKeyArray{
&compute.LinuxVirtualMachineScaleSetAdminSshKeyArgs{
Username: pulumi.String("myadmin"),
PublicKey: pulumi.String("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com"),
},
},
NetworkInterfaces: compute.LinuxVirtualMachineScaleSetNetworkInterfaceArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceArgs{
Name: pulumi.String("TestNetworkProfile"),
Primary: pulumi.Bool(true),
IpConfigurations: compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs{
Name: pulumi.String("TestIPConfiguration"),
Primary: pulumi.Bool(true),
SubnetId: exampleSubnet.ID(),
},
},
},
},
OsDisk: &compute.LinuxVirtualMachineScaleSetOsDiskArgs{
Caching: pulumi.String("ReadWrite"),
StorageAccountType: pulumi.String("StandardSSD_LRS"),
},
SourceImageReference: &compute.LinuxVirtualMachineScaleSetSourceImageReferenceArgs{
Publisher: pulumi.String("Canonical"),
Offer: pulumi.String("0001-com-ubuntu-server-jammy"),
Sku: pulumi.String("22_04-lts"),
Version: pulumi.String("latest"),
},
})
if err != nil {
return err
}
_, err = monitoring.NewAutoscaleSetting(ctx, "example", &monitoring.AutoscaleSettingArgs{
Name: pulumi.String("myAutoscaleSetting"),
ResourceGroupName: example.Name,
Location: example.Location,
TargetResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
Profiles: monitoring.AutoscaleSettingProfileArray{
&monitoring.AutoscaleSettingProfileArgs{
Name: pulumi.String("defaultProfile"),
Capacity: &monitoring.AutoscaleSettingProfileCapacityArgs{
Default: pulumi.Int(1),
Minimum: pulumi.Int(1),
Maximum: pulumi.Int(10),
},
Rules: monitoring.AutoscaleSettingProfileRuleArray{
&monitoring.AutoscaleSettingProfileRuleArgs{
MetricTrigger: &monitoring.AutoscaleSettingProfileRuleMetricTriggerArgs{
MetricName: pulumi.String("Percentage CPU"),
MetricResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
TimeGrain: pulumi.String("PT1M"),
Statistic: pulumi.String("Average"),
TimeWindow: pulumi.String("PT5M"),
TimeAggregation: pulumi.String("Average"),
Operator: pulumi.String("GreaterThan"),
Threshold: pulumi.Float64(75),
MetricNamespace: pulumi.String("microsoft.compute/virtualmachinescalesets"),
Dimensions: monitoring.AutoscaleSettingProfileRuleMetricTriggerDimensionArray{
&monitoring.AutoscaleSettingProfileRuleMetricTriggerDimensionArgs{
Name: pulumi.String("AppName"),
Operator: pulumi.String("Equals"),
Values: pulumi.StringArray{
pulumi.String("App1"),
},
},
},
},
ScaleAction: &monitoring.AutoscaleSettingProfileRuleScaleActionArgs{
Direction: pulumi.String("Increase"),
Type: pulumi.String("ChangeCount"),
Value: pulumi.Int(1),
Cooldown: pulumi.String("PT1M"),
},
},
&monitoring.AutoscaleSettingProfileRuleArgs{
MetricTrigger: &monitoring.AutoscaleSettingProfileRuleMetricTriggerArgs{
MetricName: pulumi.String("Percentage CPU"),
MetricResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
TimeGrain: pulumi.String("PT1M"),
Statistic: pulumi.String("Average"),
TimeWindow: pulumi.String("PT5M"),
TimeAggregation: pulumi.String("Average"),
Operator: pulumi.String("LessThan"),
Threshold: pulumi.Float64(25),
},
ScaleAction: &monitoring.AutoscaleSettingProfileRuleScaleActionArgs{
Direction: pulumi.String("Decrease"),
Type: pulumi.String("ChangeCount"),
Value: pulumi.Int(1),
Cooldown: pulumi.String("PT1M"),
},
},
},
},
},
Predictive: &monitoring.AutoscaleSettingPredictiveArgs{
ScaleMode: pulumi.String("Enabled"),
LookAheadTime: pulumi.String("PT5M"),
},
Notification: &monitoring.AutoscaleSettingNotificationArgs{
Email: &monitoring.AutoscaleSettingNotificationEmailArgs{
SendToSubscriptionAdministrator: pulumi.Bool(true),
SendToSubscriptionCoAdministrator: pulumi.Bool(true),
CustomEmails: pulumi.StringArray{
pulumi.String("admin@contoso.com"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "autoscalingTest",
Location = "West Europe",
});
var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
{
Name = "acctvn",
AddressSpaces = new[]
{
"10.0.0.0/16",
},
Location = example.Location,
ResourceGroupName = example.Name,
});
var exampleSubnet = new Azure.Network.Subnet("example", new()
{
Name = "acctsub",
ResourceGroupName = example.Name,
VirtualNetworkName = exampleVirtualNetwork.Name,
AddressPrefixes = new[]
{
"10.0.2.0/24",
},
});
var exampleLinuxVirtualMachineScaleSet = new Azure.Compute.LinuxVirtualMachineScaleSet("example", new()
{
Name = "exampleset",
Location = example.Location,
ResourceGroupName = example.Name,
UpgradeMode = "Manual",
Sku = "Standard_F2",
Instances = 2,
AdminUsername = "myadmin",
AdminSshKeys = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs
{
Username = "myadmin",
PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
},
},
NetworkInterfaces = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs
{
Name = "TestNetworkProfile",
Primary = true,
IpConfigurations = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs
{
Name = "TestIPConfiguration",
Primary = true,
SubnetId = exampleSubnet.Id,
},
},
},
},
OsDisk = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetOsDiskArgs
{
Caching = "ReadWrite",
StorageAccountType = "StandardSSD_LRS",
},
SourceImageReference = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-jammy",
Sku = "22_04-lts",
Version = "latest",
},
});
var exampleAutoscaleSetting = new Azure.Monitoring.AutoscaleSetting("example", new()
{
Name = "myAutoscaleSetting",
ResourceGroupName = example.Name,
Location = example.Location,
TargetResourceId = exampleLinuxVirtualMachineScaleSet.Id,
Profiles = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileArgs
{
Name = "defaultProfile",
Capacity = new Azure.Monitoring.Inputs.AutoscaleSettingProfileCapacityArgs
{
Default = 1,
Minimum = 1,
Maximum = 10,
},
Rules = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleArgs
{
MetricTrigger = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerArgs
{
MetricName = "Percentage CPU",
MetricResourceId = exampleLinuxVirtualMachineScaleSet.Id,
TimeGrain = "PT1M",
Statistic = "Average",
TimeWindow = "PT5M",
TimeAggregation = "Average",
Operator = "GreaterThan",
Threshold = 75,
MetricNamespace = "microsoft.compute/virtualmachinescalesets",
Dimensions = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerDimensionArgs
{
Name = "AppName",
Operator = "Equals",
Values = new[]
{
"App1",
},
},
},
},
ScaleAction = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleScaleActionArgs
{
Direction = "Increase",
Type = "ChangeCount",
Value = 1,
Cooldown = "PT1M",
},
},
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleArgs
{
MetricTrigger = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerArgs
{
MetricName = "Percentage CPU",
MetricResourceId = exampleLinuxVirtualMachineScaleSet.Id,
TimeGrain = "PT1M",
Statistic = "Average",
TimeWindow = "PT5M",
TimeAggregation = "Average",
Operator = "LessThan",
Threshold = 25,
},
ScaleAction = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleScaleActionArgs
{
Direction = "Decrease",
Type = "ChangeCount",
Value = 1,
Cooldown = "PT1M",
},
},
},
},
},
Predictive = new Azure.Monitoring.Inputs.AutoscaleSettingPredictiveArgs
{
ScaleMode = "Enabled",
LookAheadTime = "PT5M",
},
Notification = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationArgs
{
Email = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationEmailArgs
{
SendToSubscriptionAdministrator = true,
SendToSubscriptionCoAdministrator = true,
CustomEmails = new[]
{
"admin@contoso.com",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSet;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSetArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetOsDiskArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs;
import com.pulumi.azure.monitoring.AutoscaleSetting;
import com.pulumi.azure.monitoring.AutoscaleSettingArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileCapacityArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingPredictiveArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingNotificationArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingNotificationEmailArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("autoscalingTest")
.location("West Europe")
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.name("acctvn")
.addressSpaces("10.0.0.0/16")
.location(example.location())
.resourceGroupName(example.name())
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.name("acctsub")
.resourceGroupName(example.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.2.0/24")
.build());
var exampleLinuxVirtualMachineScaleSet = new LinuxVirtualMachineScaleSet("exampleLinuxVirtualMachineScaleSet", LinuxVirtualMachineScaleSetArgs.builder()
.name("exampleset")
.location(example.location())
.resourceGroupName(example.name())
.upgradeMode("Manual")
.sku("Standard_F2")
.instances(2)
.adminUsername("myadmin")
.adminSshKeys(LinuxVirtualMachineScaleSetAdminSshKeyArgs.builder()
.username("myadmin")
.publicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com")
.build())
.networkInterfaces(LinuxVirtualMachineScaleSetNetworkInterfaceArgs.builder()
.name("TestNetworkProfile")
.primary(true)
.ipConfigurations(LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs.builder()
.name("TestIPConfiguration")
.primary(true)
.subnetId(exampleSubnet.id())
.build())
.build())
.osDisk(LinuxVirtualMachineScaleSetOsDiskArgs.builder()
.caching("ReadWrite")
.storageAccountType("StandardSSD_LRS")
.build())
.sourceImageReference(LinuxVirtualMachineScaleSetSourceImageReferenceArgs.builder()
.publisher("Canonical")
.offer("0001-com-ubuntu-server-jammy")
.sku("22_04-lts")
.version("latest")
.build())
.build());
var exampleAutoscaleSetting = new AutoscaleSetting("exampleAutoscaleSetting", AutoscaleSettingArgs.builder()
.name("myAutoscaleSetting")
.resourceGroupName(example.name())
.location(example.location())
.targetResourceId(exampleLinuxVirtualMachineScaleSet.id())
.profiles(AutoscaleSettingProfileArgs.builder()
.name("defaultProfile")
.capacity(AutoscaleSettingProfileCapacityArgs.builder()
.default_(1)
.minimum(1)
.maximum(10)
.build())
.rules(
AutoscaleSettingProfileRuleArgs.builder()
.metricTrigger(AutoscaleSettingProfileRuleMetricTriggerArgs.builder()
.metricName("Percentage CPU")
.metricResourceId(exampleLinuxVirtualMachineScaleSet.id())
.timeGrain("PT1M")
.statistic("Average")
.timeWindow("PT5M")
.timeAggregation("Average")
.operator("GreaterThan")
.threshold(75)
.metricNamespace("microsoft.compute/virtualmachinescalesets")
.dimensions(AutoscaleSettingProfileRuleMetricTriggerDimensionArgs.builder()
.name("AppName")
.operator("Equals")
.values("App1")
.build())
.build())
.scaleAction(AutoscaleSettingProfileRuleScaleActionArgs.builder()
.direction("Increase")
.type("ChangeCount")
.value("1")
.cooldown("PT1M")
.build())
.build(),
AutoscaleSettingProfileRuleArgs.builder()
.metricTrigger(AutoscaleSettingProfileRuleMetricTriggerArgs.builder()
.metricName("Percentage CPU")
.metricResourceId(exampleLinuxVirtualMachineScaleSet.id())
.timeGrain("PT1M")
.statistic("Average")
.timeWindow("PT5M")
.timeAggregation("Average")
.operator("LessThan")
.threshold(25)
.build())
.scaleAction(AutoscaleSettingProfileRuleScaleActionArgs.builder()
.direction("Decrease")
.type("ChangeCount")
.value("1")
.cooldown("PT1M")
.build())
.build())
.build())
.predictive(AutoscaleSettingPredictiveArgs.builder()
.scaleMode("Enabled")
.lookAheadTime("PT5M")
.build())
.notification(AutoscaleSettingNotificationArgs.builder()
.email(AutoscaleSettingNotificationEmailArgs.builder()
.sendToSubscriptionAdministrator(true)
.sendToSubscriptionCoAdministrator(true)
.customEmails("admin@contoso.com")
.build())
.build())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: autoscalingTest
location: West Europe
exampleVirtualNetwork:
type: azure:network:VirtualNetwork
name: example
properties:
name: acctvn
addressSpaces:
- 10.0.0.0/16
location: ${example.location}
resourceGroupName: ${example.name}
exampleSubnet:
type: azure:network:Subnet
name: example
properties:
name: acctsub
resourceGroupName: ${example.name}
virtualNetworkName: ${exampleVirtualNetwork.name}
addressPrefixes:
- 10.0.2.0/24
exampleLinuxVirtualMachineScaleSet:
type: azure:compute:LinuxVirtualMachineScaleSet
name: example
properties:
name: exampleset
location: ${example.location}
resourceGroupName: ${example.name}
upgradeMode: Manual
sku: Standard_F2
instances: 2
adminUsername: myadmin
adminSshKeys:
- username: myadmin
publicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com
networkInterfaces:
- name: TestNetworkProfile
primary: true
ipConfigurations:
- name: TestIPConfiguration
primary: true
subnetId: ${exampleSubnet.id}
osDisk:
caching: ReadWrite
storageAccountType: StandardSSD_LRS
sourceImageReference:
publisher: Canonical
offer: 0001-com-ubuntu-server-jammy
sku: 22_04-lts
version: latest
exampleAutoscaleSetting:
type: azure:monitoring:AutoscaleSetting
name: example
properties:
name: myAutoscaleSetting
resourceGroupName: ${example.name}
location: ${example.location}
targetResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
profiles:
- name: defaultProfile
capacity:
default: 1
minimum: 1
maximum: 10
rules:
- metricTrigger:
metricName: Percentage CPU
metricResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
timeGrain: PT1M
statistic: Average
timeWindow: PT5M
timeAggregation: Average
operator: GreaterThan
threshold: 75
metricNamespace: microsoft.compute/virtualmachinescalesets
dimensions:
- name: AppName
operator: Equals
values:
- App1
scaleAction:
direction: Increase
type: ChangeCount
value: '1'
cooldown: PT1M
- metricTrigger:
metricName: Percentage CPU
metricResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
timeGrain: PT1M
statistic: Average
timeWindow: PT5M
timeAggregation: Average
operator: LessThan
threshold: 25
scaleAction:
direction: Decrease
type: ChangeCount
value: '1'
cooldown: PT1M
predictive:
scaleMode: Enabled
lookAheadTime: PT5M
notification:
email:
sendToSubscriptionAdministrator: true
sendToSubscriptionCoAdministrator: true
customEmails:
- admin@contoso.com
Repeating On Weekends)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "autoscalingTest",
location: "West Europe",
});
const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
name: "acctvn",
addressSpaces: ["10.0.0.0/16"],
location: example.location,
resourceGroupName: example.name,
});
const exampleSubnet = new azure.network.Subnet("example", {
name: "acctsub",
resourceGroupName: example.name,
virtualNetworkName: exampleVirtualNetwork.name,
addressPrefixes: ["10.0.2.0/24"],
});
const exampleLinuxVirtualMachineScaleSet = new azure.compute.LinuxVirtualMachineScaleSet("example", {
name: "exampleset",
location: example.location,
resourceGroupName: example.name,
upgradeMode: "Manual",
sku: "Standard_F2",
instances: 2,
adminUsername: "myadmin",
adminSshKeys: [{
username: "myadmin",
publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
}],
networkInterfaces: [{
name: "TestNetworkProfile",
primary: true,
ipConfigurations: [{
name: "TestIPConfiguration",
primary: true,
subnetId: exampleSubnet.id,
}],
}],
osDisk: {
caching: "ReadWrite",
storageAccountType: "StandardSSD_LRS",
},
sourceImageReference: {
publisher: "Canonical",
offer: "0001-com-ubuntu-server-jammy",
sku: "22_04-lts",
version: "latest",
},
});
const exampleAutoscaleSetting = new azure.monitoring.AutoscaleSetting("example", {
name: "myAutoscaleSetting",
resourceGroupName: example.name,
location: example.location,
targetResourceId: exampleLinuxVirtualMachineScaleSet.id,
profiles: [{
name: "Weekends",
capacity: {
"default": 1,
minimum: 1,
maximum: 10,
},
rules: [
{
metricTrigger: {
metricName: "Percentage CPU",
metricResourceId: exampleLinuxVirtualMachineScaleSet.id,
timeGrain: "PT1M",
statistic: "Average",
timeWindow: "PT5M",
timeAggregation: "Average",
operator: "GreaterThan",
threshold: 90,
},
scaleAction: {
direction: "Increase",
type: "ChangeCount",
value: 2,
cooldown: "PT1M",
},
},
{
metricTrigger: {
metricName: "Percentage CPU",
metricResourceId: exampleLinuxVirtualMachineScaleSet.id,
timeGrain: "PT1M",
statistic: "Average",
timeWindow: "PT5M",
timeAggregation: "Average",
operator: "LessThan",
threshold: 10,
},
scaleAction: {
direction: "Decrease",
type: "ChangeCount",
value: 2,
cooldown: "PT1M",
},
},
],
recurrence: {
timezone: "Pacific Standard Time",
days: [
"Saturday",
"Sunday",
],
hours: 12,
minutes: 0,
},
}],
notification: {
email: {
sendToSubscriptionAdministrator: true,
sendToSubscriptionCoAdministrator: true,
customEmails: ["admin@contoso.com"],
},
},
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="autoscalingTest",
location="West Europe")
example_virtual_network = azure.network.VirtualNetwork("example",
name="acctvn",
address_spaces=["10.0.0.0/16"],
location=example.location,
resource_group_name=example.name)
example_subnet = azure.network.Subnet("example",
name="acctsub",
resource_group_name=example.name,
virtual_network_name=example_virtual_network.name,
address_prefixes=["10.0.2.0/24"])
example_linux_virtual_machine_scale_set = azure.compute.LinuxVirtualMachineScaleSet("example",
name="exampleset",
location=example.location,
resource_group_name=example.name,
upgrade_mode="Manual",
sku="Standard_F2",
instances=2,
admin_username="myadmin",
admin_ssh_keys=[{
"username": "myadmin",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
}],
network_interfaces=[{
"name": "TestNetworkProfile",
"primary": True,
"ip_configurations": [{
"name": "TestIPConfiguration",
"primary": True,
"subnet_id": example_subnet.id,
}],
}],
os_disk={
"caching": "ReadWrite",
"storage_account_type": "StandardSSD_LRS",
},
source_image_reference={
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts",
"version": "latest",
})
example_autoscale_setting = azure.monitoring.AutoscaleSetting("example",
name="myAutoscaleSetting",
resource_group_name=example.name,
location=example.location,
target_resource_id=example_linux_virtual_machine_scale_set.id,
profiles=[{
"name": "Weekends",
"capacity": {
"default": 1,
"minimum": 1,
"maximum": 10,
},
"rules": [
{
"metric_trigger": {
"metric_name": "Percentage CPU",
"metric_resource_id": example_linux_virtual_machine_scale_set.id,
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT5M",
"time_aggregation": "Average",
"operator": "GreaterThan",
"threshold": 90,
},
"scale_action": {
"direction": "Increase",
"type": "ChangeCount",
"value": 2,
"cooldown": "PT1M",
},
},
{
"metric_trigger": {
"metric_name": "Percentage CPU",
"metric_resource_id": example_linux_virtual_machine_scale_set.id,
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT5M",
"time_aggregation": "Average",
"operator": "LessThan",
"threshold": 10,
},
"scale_action": {
"direction": "Decrease",
"type": "ChangeCount",
"value": 2,
"cooldown": "PT1M",
},
},
],
"recurrence": {
"timezone": "Pacific Standard Time",
"days": [
"Saturday",
"Sunday",
],
"hours": 12,
"minutes": 0,
},
}],
notification={
"email": {
"send_to_subscription_administrator": True,
"send_to_subscription_co_administrator": True,
"custom_emails": ["admin@contoso.com"],
},
})
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/monitoring"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("autoscalingTest"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
Name: pulumi.String("acctvn"),
AddressSpaces: pulumi.StringArray{
pulumi.String("10.0.0.0/16"),
},
Location: example.Location,
ResourceGroupName: example.Name,
})
if err != nil {
return err
}
exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
Name: pulumi.String("acctsub"),
ResourceGroupName: example.Name,
VirtualNetworkName: exampleVirtualNetwork.Name,
AddressPrefixes: pulumi.StringArray{
pulumi.String("10.0.2.0/24"),
},
})
if err != nil {
return err
}
exampleLinuxVirtualMachineScaleSet, err := compute.NewLinuxVirtualMachineScaleSet(ctx, "example", &compute.LinuxVirtualMachineScaleSetArgs{
Name: pulumi.String("exampleset"),
Location: example.Location,
ResourceGroupName: example.Name,
UpgradeMode: pulumi.String("Manual"),
Sku: pulumi.String("Standard_F2"),
Instances: pulumi.Int(2),
AdminUsername: pulumi.String("myadmin"),
AdminSshKeys: compute.LinuxVirtualMachineScaleSetAdminSshKeyArray{
&compute.LinuxVirtualMachineScaleSetAdminSshKeyArgs{
Username: pulumi.String("myadmin"),
PublicKey: pulumi.String("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com"),
},
},
NetworkInterfaces: compute.LinuxVirtualMachineScaleSetNetworkInterfaceArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceArgs{
Name: pulumi.String("TestNetworkProfile"),
Primary: pulumi.Bool(true),
IpConfigurations: compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs{
Name: pulumi.String("TestIPConfiguration"),
Primary: pulumi.Bool(true),
SubnetId: exampleSubnet.ID(),
},
},
},
},
OsDisk: &compute.LinuxVirtualMachineScaleSetOsDiskArgs{
Caching: pulumi.String("ReadWrite"),
StorageAccountType: pulumi.String("StandardSSD_LRS"),
},
SourceImageReference: &compute.LinuxVirtualMachineScaleSetSourceImageReferenceArgs{
Publisher: pulumi.String("Canonical"),
Offer: pulumi.String("0001-com-ubuntu-server-jammy"),
Sku: pulumi.String("22_04-lts"),
Version: pulumi.String("latest"),
},
})
if err != nil {
return err
}
_, err = monitoring.NewAutoscaleSetting(ctx, "example", &monitoring.AutoscaleSettingArgs{
Name: pulumi.String("myAutoscaleSetting"),
ResourceGroupName: example.Name,
Location: example.Location,
TargetResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
Profiles: monitoring.AutoscaleSettingProfileArray{
&monitoring.AutoscaleSettingProfileArgs{
Name: pulumi.String("Weekends"),
Capacity: &monitoring.AutoscaleSettingProfileCapacityArgs{
Default: pulumi.Int(1),
Minimum: pulumi.Int(1),
Maximum: pulumi.Int(10),
},
Rules: monitoring.AutoscaleSettingProfileRuleArray{
&monitoring.AutoscaleSettingProfileRuleArgs{
MetricTrigger: &monitoring.AutoscaleSettingProfileRuleMetricTriggerArgs{
MetricName: pulumi.String("Percentage CPU"),
MetricResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
TimeGrain: pulumi.String("PT1M"),
Statistic: pulumi.String("Average"),
TimeWindow: pulumi.String("PT5M"),
TimeAggregation: pulumi.String("Average"),
Operator: pulumi.String("GreaterThan"),
Threshold: pulumi.Float64(90),
},
ScaleAction: &monitoring.AutoscaleSettingProfileRuleScaleActionArgs{
Direction: pulumi.String("Increase"),
Type: pulumi.String("ChangeCount"),
Value: pulumi.Int(2),
Cooldown: pulumi.String("PT1M"),
},
},
&monitoring.AutoscaleSettingProfileRuleArgs{
MetricTrigger: &monitoring.AutoscaleSettingProfileRuleMetricTriggerArgs{
MetricName: pulumi.String("Percentage CPU"),
MetricResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
TimeGrain: pulumi.String("PT1M"),
Statistic: pulumi.String("Average"),
TimeWindow: pulumi.String("PT5M"),
TimeAggregation: pulumi.String("Average"),
Operator: pulumi.String("LessThan"),
Threshold: pulumi.Float64(10),
},
ScaleAction: &monitoring.AutoscaleSettingProfileRuleScaleActionArgs{
Direction: pulumi.String("Decrease"),
Type: pulumi.String("ChangeCount"),
Value: pulumi.Int(2),
Cooldown: pulumi.String("PT1M"),
},
},
},
Recurrence: &monitoring.AutoscaleSettingProfileRecurrenceArgs{
Timezone: pulumi.String("Pacific Standard Time"),
Days: pulumi.StringArray{
pulumi.String("Saturday"),
pulumi.String("Sunday"),
},
Hours: pulumi.Int(12),
Minutes: pulumi.Int(0),
},
},
},
Notification: &monitoring.AutoscaleSettingNotificationArgs{
Email: &monitoring.AutoscaleSettingNotificationEmailArgs{
SendToSubscriptionAdministrator: pulumi.Bool(true),
SendToSubscriptionCoAdministrator: pulumi.Bool(true),
CustomEmails: pulumi.StringArray{
pulumi.String("admin@contoso.com"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "autoscalingTest",
Location = "West Europe",
});
var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
{
Name = "acctvn",
AddressSpaces = new[]
{
"10.0.0.0/16",
},
Location = example.Location,
ResourceGroupName = example.Name,
});
var exampleSubnet = new Azure.Network.Subnet("example", new()
{
Name = "acctsub",
ResourceGroupName = example.Name,
VirtualNetworkName = exampleVirtualNetwork.Name,
AddressPrefixes = new[]
{
"10.0.2.0/24",
},
});
var exampleLinuxVirtualMachineScaleSet = new Azure.Compute.LinuxVirtualMachineScaleSet("example", new()
{
Name = "exampleset",
Location = example.Location,
ResourceGroupName = example.Name,
UpgradeMode = "Manual",
Sku = "Standard_F2",
Instances = 2,
AdminUsername = "myadmin",
AdminSshKeys = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs
{
Username = "myadmin",
PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
},
},
NetworkInterfaces = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs
{
Name = "TestNetworkProfile",
Primary = true,
IpConfigurations = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs
{
Name = "TestIPConfiguration",
Primary = true,
SubnetId = exampleSubnet.Id,
},
},
},
},
OsDisk = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetOsDiskArgs
{
Caching = "ReadWrite",
StorageAccountType = "StandardSSD_LRS",
},
SourceImageReference = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-jammy",
Sku = "22_04-lts",
Version = "latest",
},
});
var exampleAutoscaleSetting = new Azure.Monitoring.AutoscaleSetting("example", new()
{
Name = "myAutoscaleSetting",
ResourceGroupName = example.Name,
Location = example.Location,
TargetResourceId = exampleLinuxVirtualMachineScaleSet.Id,
Profiles = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileArgs
{
Name = "Weekends",
Capacity = new Azure.Monitoring.Inputs.AutoscaleSettingProfileCapacityArgs
{
Default = 1,
Minimum = 1,
Maximum = 10,
},
Rules = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleArgs
{
MetricTrigger = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerArgs
{
MetricName = "Percentage CPU",
MetricResourceId = exampleLinuxVirtualMachineScaleSet.Id,
TimeGrain = "PT1M",
Statistic = "Average",
TimeWindow = "PT5M",
TimeAggregation = "Average",
Operator = "GreaterThan",
Threshold = 90,
},
ScaleAction = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleScaleActionArgs
{
Direction = "Increase",
Type = "ChangeCount",
Value = 2,
Cooldown = "PT1M",
},
},
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleArgs
{
MetricTrigger = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerArgs
{
MetricName = "Percentage CPU",
MetricResourceId = exampleLinuxVirtualMachineScaleSet.Id,
TimeGrain = "PT1M",
Statistic = "Average",
TimeWindow = "PT5M",
TimeAggregation = "Average",
Operator = "LessThan",
Threshold = 10,
},
ScaleAction = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleScaleActionArgs
{
Direction = "Decrease",
Type = "ChangeCount",
Value = 2,
Cooldown = "PT1M",
},
},
},
Recurrence = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRecurrenceArgs
{
Timezone = "Pacific Standard Time",
Days = new[]
{
"Saturday",
"Sunday",
},
Hours = 12,
Minutes = 0,
},
},
},
Notification = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationArgs
{
Email = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationEmailArgs
{
SendToSubscriptionAdministrator = true,
SendToSubscriptionCoAdministrator = true,
CustomEmails = new[]
{
"admin@contoso.com",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSet;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSetArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetOsDiskArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs;
import com.pulumi.azure.monitoring.AutoscaleSetting;
import com.pulumi.azure.monitoring.AutoscaleSettingArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileCapacityArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileRecurrenceArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingNotificationArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingNotificationEmailArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("autoscalingTest")
.location("West Europe")
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.name("acctvn")
.addressSpaces("10.0.0.0/16")
.location(example.location())
.resourceGroupName(example.name())
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.name("acctsub")
.resourceGroupName(example.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.2.0/24")
.build());
var exampleLinuxVirtualMachineScaleSet = new LinuxVirtualMachineScaleSet("exampleLinuxVirtualMachineScaleSet", LinuxVirtualMachineScaleSetArgs.builder()
.name("exampleset")
.location(example.location())
.resourceGroupName(example.name())
.upgradeMode("Manual")
.sku("Standard_F2")
.instances(2)
.adminUsername("myadmin")
.adminSshKeys(LinuxVirtualMachineScaleSetAdminSshKeyArgs.builder()
.username("myadmin")
.publicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com")
.build())
.networkInterfaces(LinuxVirtualMachineScaleSetNetworkInterfaceArgs.builder()
.name("TestNetworkProfile")
.primary(true)
.ipConfigurations(LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs.builder()
.name("TestIPConfiguration")
.primary(true)
.subnetId(exampleSubnet.id())
.build())
.build())
.osDisk(LinuxVirtualMachineScaleSetOsDiskArgs.builder()
.caching("ReadWrite")
.storageAccountType("StandardSSD_LRS")
.build())
.sourceImageReference(LinuxVirtualMachineScaleSetSourceImageReferenceArgs.builder()
.publisher("Canonical")
.offer("0001-com-ubuntu-server-jammy")
.sku("22_04-lts")
.version("latest")
.build())
.build());
var exampleAutoscaleSetting = new AutoscaleSetting("exampleAutoscaleSetting", AutoscaleSettingArgs.builder()
.name("myAutoscaleSetting")
.resourceGroupName(example.name())
.location(example.location())
.targetResourceId(exampleLinuxVirtualMachineScaleSet.id())
.profiles(AutoscaleSettingProfileArgs.builder()
.name("Weekends")
.capacity(AutoscaleSettingProfileCapacityArgs.builder()
.default_(1)
.minimum(1)
.maximum(10)
.build())
.rules(
AutoscaleSettingProfileRuleArgs.builder()
.metricTrigger(AutoscaleSettingProfileRuleMetricTriggerArgs.builder()
.metricName("Percentage CPU")
.metricResourceId(exampleLinuxVirtualMachineScaleSet.id())
.timeGrain("PT1M")
.statistic("Average")
.timeWindow("PT5M")
.timeAggregation("Average")
.operator("GreaterThan")
.threshold(90)
.build())
.scaleAction(AutoscaleSettingProfileRuleScaleActionArgs.builder()
.direction("Increase")
.type("ChangeCount")
.value("2")
.cooldown("PT1M")
.build())
.build(),
AutoscaleSettingProfileRuleArgs.builder()
.metricTrigger(AutoscaleSettingProfileRuleMetricTriggerArgs.builder()
.metricName("Percentage CPU")
.metricResourceId(exampleLinuxVirtualMachineScaleSet.id())
.timeGrain("PT1M")
.statistic("Average")
.timeWindow("PT5M")
.timeAggregation("Average")
.operator("LessThan")
.threshold(10)
.build())
.scaleAction(AutoscaleSettingProfileRuleScaleActionArgs.builder()
.direction("Decrease")
.type("ChangeCount")
.value("2")
.cooldown("PT1M")
.build())
.build())
.recurrence(AutoscaleSettingProfileRecurrenceArgs.builder()
.timezone("Pacific Standard Time")
.days(
"Saturday",
"Sunday")
.hours(12)
.minutes(0)
.build())
.build())
.notification(AutoscaleSettingNotificationArgs.builder()
.email(AutoscaleSettingNotificationEmailArgs.builder()
.sendToSubscriptionAdministrator(true)
.sendToSubscriptionCoAdministrator(true)
.customEmails("admin@contoso.com")
.build())
.build())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: autoscalingTest
location: West Europe
exampleVirtualNetwork:
type: azure:network:VirtualNetwork
name: example
properties:
name: acctvn
addressSpaces:
- 10.0.0.0/16
location: ${example.location}
resourceGroupName: ${example.name}
exampleSubnet:
type: azure:network:Subnet
name: example
properties:
name: acctsub
resourceGroupName: ${example.name}
virtualNetworkName: ${exampleVirtualNetwork.name}
addressPrefixes:
- 10.0.2.0/24
exampleLinuxVirtualMachineScaleSet:
type: azure:compute:LinuxVirtualMachineScaleSet
name: example
properties:
name: exampleset
location: ${example.location}
resourceGroupName: ${example.name}
upgradeMode: Manual
sku: Standard_F2
instances: 2
adminUsername: myadmin
adminSshKeys:
- username: myadmin
publicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com
networkInterfaces:
- name: TestNetworkProfile
primary: true
ipConfigurations:
- name: TestIPConfiguration
primary: true
subnetId: ${exampleSubnet.id}
osDisk:
caching: ReadWrite
storageAccountType: StandardSSD_LRS
sourceImageReference:
publisher: Canonical
offer: 0001-com-ubuntu-server-jammy
sku: 22_04-lts
version: latest
exampleAutoscaleSetting:
type: azure:monitoring:AutoscaleSetting
name: example
properties:
name: myAutoscaleSetting
resourceGroupName: ${example.name}
location: ${example.location}
targetResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
profiles:
- name: Weekends
capacity:
default: 1
minimum: 1
maximum: 10
rules:
- metricTrigger:
metricName: Percentage CPU
metricResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
timeGrain: PT1M
statistic: Average
timeWindow: PT5M
timeAggregation: Average
operator: GreaterThan
threshold: 90
scaleAction:
direction: Increase
type: ChangeCount
value: '2'
cooldown: PT1M
- metricTrigger:
metricName: Percentage CPU
metricResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
timeGrain: PT1M
statistic: Average
timeWindow: PT5M
timeAggregation: Average
operator: LessThan
threshold: 10
scaleAction:
direction: Decrease
type: ChangeCount
value: '2'
cooldown: PT1M
recurrence:
timezone: Pacific Standard Time
days:
- Saturday
- Sunday
hours: 12
minutes: 0
notification:
email:
sendToSubscriptionAdministrator: true
sendToSubscriptionCoAdministrator: true
customEmails:
- admin@contoso.com
For Fixed Dates)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "autoscalingTest",
location: "West Europe",
});
const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
name: "acctvn",
addressSpaces: ["10.0.0.0/16"],
location: example.location,
resourceGroupName: example.name,
});
const exampleSubnet = new azure.network.Subnet("example", {
name: "acctsub",
resourceGroupName: example.name,
virtualNetworkName: exampleVirtualNetwork.name,
addressPrefixes: ["10.0.2.0/24"],
});
const exampleLinuxVirtualMachineScaleSet = new azure.compute.LinuxVirtualMachineScaleSet("example", {
name: "exampleset",
location: example.location,
resourceGroupName: example.name,
upgradeMode: "Manual",
sku: "Standard_F2",
instances: 2,
adminUsername: "myadmin",
adminSshKeys: [{
username: "myadmin",
publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
}],
networkInterfaces: [{
name: "TestNetworkProfile",
primary: true,
ipConfigurations: [{
name: "TestIPConfiguration",
primary: true,
subnetId: exampleSubnet.id,
}],
}],
osDisk: {
caching: "ReadWrite",
storageAccountType: "StandardSSD_LRS",
},
sourceImageReference: {
publisher: "Canonical",
offer: "0001-com-ubuntu-server-jammy",
sku: "22_04-lts",
version: "latest",
},
});
const exampleAutoscaleSetting = new azure.monitoring.AutoscaleSetting("example", {
name: "myAutoscaleSetting",
enabled: true,
resourceGroupName: example.name,
location: example.location,
targetResourceId: exampleLinuxVirtualMachineScaleSet.id,
profiles: [{
name: "forJuly",
capacity: {
"default": 1,
minimum: 1,
maximum: 10,
},
rules: [
{
metricTrigger: {
metricName: "Percentage CPU",
metricResourceId: exampleLinuxVirtualMachineScaleSet.id,
timeGrain: "PT1M",
statistic: "Average",
timeWindow: "PT5M",
timeAggregation: "Average",
operator: "GreaterThan",
threshold: 90,
},
scaleAction: {
direction: "Increase",
type: "ChangeCount",
value: 2,
cooldown: "PT1M",
},
},
{
metricTrigger: {
metricName: "Percentage CPU",
metricResourceId: exampleLinuxVirtualMachineScaleSet.id,
timeGrain: "PT1M",
statistic: "Average",
timeWindow: "PT5M",
timeAggregation: "Average",
operator: "LessThan",
threshold: 10,
},
scaleAction: {
direction: "Decrease",
type: "ChangeCount",
value: 2,
cooldown: "PT1M",
},
},
],
fixedDate: {
timezone: "Pacific Standard Time",
start: "2020-07-01T00:00:00Z",
end: "2020-07-31T23:59:59Z",
},
}],
notification: {
email: {
sendToSubscriptionAdministrator: true,
sendToSubscriptionCoAdministrator: true,
customEmails: ["admin@contoso.com"],
},
},
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="autoscalingTest",
location="West Europe")
example_virtual_network = azure.network.VirtualNetwork("example",
name="acctvn",
address_spaces=["10.0.0.0/16"],
location=example.location,
resource_group_name=example.name)
example_subnet = azure.network.Subnet("example",
name="acctsub",
resource_group_name=example.name,
virtual_network_name=example_virtual_network.name,
address_prefixes=["10.0.2.0/24"])
example_linux_virtual_machine_scale_set = azure.compute.LinuxVirtualMachineScaleSet("example",
name="exampleset",
location=example.location,
resource_group_name=example.name,
upgrade_mode="Manual",
sku="Standard_F2",
instances=2,
admin_username="myadmin",
admin_ssh_keys=[{
"username": "myadmin",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
}],
network_interfaces=[{
"name": "TestNetworkProfile",
"primary": True,
"ip_configurations": [{
"name": "TestIPConfiguration",
"primary": True,
"subnet_id": example_subnet.id,
}],
}],
os_disk={
"caching": "ReadWrite",
"storage_account_type": "StandardSSD_LRS",
},
source_image_reference={
"publisher": "Canonical",
"offer": "0001-com-ubuntu-server-jammy",
"sku": "22_04-lts",
"version": "latest",
})
example_autoscale_setting = azure.monitoring.AutoscaleSetting("example",
name="myAutoscaleSetting",
enabled=True,
resource_group_name=example.name,
location=example.location,
target_resource_id=example_linux_virtual_machine_scale_set.id,
profiles=[{
"name": "forJuly",
"capacity": {
"default": 1,
"minimum": 1,
"maximum": 10,
},
"rules": [
{
"metric_trigger": {
"metric_name": "Percentage CPU",
"metric_resource_id": example_linux_virtual_machine_scale_set.id,
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT5M",
"time_aggregation": "Average",
"operator": "GreaterThan",
"threshold": 90,
},
"scale_action": {
"direction": "Increase",
"type": "ChangeCount",
"value": 2,
"cooldown": "PT1M",
},
},
{
"metric_trigger": {
"metric_name": "Percentage CPU",
"metric_resource_id": example_linux_virtual_machine_scale_set.id,
"time_grain": "PT1M",
"statistic": "Average",
"time_window": "PT5M",
"time_aggregation": "Average",
"operator": "LessThan",
"threshold": 10,
},
"scale_action": {
"direction": "Decrease",
"type": "ChangeCount",
"value": 2,
"cooldown": "PT1M",
},
},
],
"fixed_date": {
"timezone": "Pacific Standard Time",
"start": "2020-07-01T00:00:00Z",
"end": "2020-07-31T23:59:59Z",
},
}],
notification={
"email": {
"send_to_subscription_administrator": True,
"send_to_subscription_co_administrator": True,
"custom_emails": ["admin@contoso.com"],
},
})
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/monitoring"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("autoscalingTest"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
Name: pulumi.String("acctvn"),
AddressSpaces: pulumi.StringArray{
pulumi.String("10.0.0.0/16"),
},
Location: example.Location,
ResourceGroupName: example.Name,
})
if err != nil {
return err
}
exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
Name: pulumi.String("acctsub"),
ResourceGroupName: example.Name,
VirtualNetworkName: exampleVirtualNetwork.Name,
AddressPrefixes: pulumi.StringArray{
pulumi.String("10.0.2.0/24"),
},
})
if err != nil {
return err
}
exampleLinuxVirtualMachineScaleSet, err := compute.NewLinuxVirtualMachineScaleSet(ctx, "example", &compute.LinuxVirtualMachineScaleSetArgs{
Name: pulumi.String("exampleset"),
Location: example.Location,
ResourceGroupName: example.Name,
UpgradeMode: pulumi.String("Manual"),
Sku: pulumi.String("Standard_F2"),
Instances: pulumi.Int(2),
AdminUsername: pulumi.String("myadmin"),
AdminSshKeys: compute.LinuxVirtualMachineScaleSetAdminSshKeyArray{
&compute.LinuxVirtualMachineScaleSetAdminSshKeyArgs{
Username: pulumi.String("myadmin"),
PublicKey: pulumi.String("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com"),
},
},
NetworkInterfaces: compute.LinuxVirtualMachineScaleSetNetworkInterfaceArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceArgs{
Name: pulumi.String("TestNetworkProfile"),
Primary: pulumi.Bool(true),
IpConfigurations: compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArray{
&compute.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs{
Name: pulumi.String("TestIPConfiguration"),
Primary: pulumi.Bool(true),
SubnetId: exampleSubnet.ID(),
},
},
},
},
OsDisk: &compute.LinuxVirtualMachineScaleSetOsDiskArgs{
Caching: pulumi.String("ReadWrite"),
StorageAccountType: pulumi.String("StandardSSD_LRS"),
},
SourceImageReference: &compute.LinuxVirtualMachineScaleSetSourceImageReferenceArgs{
Publisher: pulumi.String("Canonical"),
Offer: pulumi.String("0001-com-ubuntu-server-jammy"),
Sku: pulumi.String("22_04-lts"),
Version: pulumi.String("latest"),
},
})
if err != nil {
return err
}
_, err = monitoring.NewAutoscaleSetting(ctx, "example", &monitoring.AutoscaleSettingArgs{
Name: pulumi.String("myAutoscaleSetting"),
Enabled: pulumi.Bool(true),
ResourceGroupName: example.Name,
Location: example.Location,
TargetResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
Profiles: monitoring.AutoscaleSettingProfileArray{
&monitoring.AutoscaleSettingProfileArgs{
Name: pulumi.String("forJuly"),
Capacity: &monitoring.AutoscaleSettingProfileCapacityArgs{
Default: pulumi.Int(1),
Minimum: pulumi.Int(1),
Maximum: pulumi.Int(10),
},
Rules: monitoring.AutoscaleSettingProfileRuleArray{
&monitoring.AutoscaleSettingProfileRuleArgs{
MetricTrigger: &monitoring.AutoscaleSettingProfileRuleMetricTriggerArgs{
MetricName: pulumi.String("Percentage CPU"),
MetricResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
TimeGrain: pulumi.String("PT1M"),
Statistic: pulumi.String("Average"),
TimeWindow: pulumi.String("PT5M"),
TimeAggregation: pulumi.String("Average"),
Operator: pulumi.String("GreaterThan"),
Threshold: pulumi.Float64(90),
},
ScaleAction: &monitoring.AutoscaleSettingProfileRuleScaleActionArgs{
Direction: pulumi.String("Increase"),
Type: pulumi.String("ChangeCount"),
Value: pulumi.Int(2),
Cooldown: pulumi.String("PT1M"),
},
},
&monitoring.AutoscaleSettingProfileRuleArgs{
MetricTrigger: &monitoring.AutoscaleSettingProfileRuleMetricTriggerArgs{
MetricName: pulumi.String("Percentage CPU"),
MetricResourceId: exampleLinuxVirtualMachineScaleSet.ID(),
TimeGrain: pulumi.String("PT1M"),
Statistic: pulumi.String("Average"),
TimeWindow: pulumi.String("PT5M"),
TimeAggregation: pulumi.String("Average"),
Operator: pulumi.String("LessThan"),
Threshold: pulumi.Float64(10),
},
ScaleAction: &monitoring.AutoscaleSettingProfileRuleScaleActionArgs{
Direction: pulumi.String("Decrease"),
Type: pulumi.String("ChangeCount"),
Value: pulumi.Int(2),
Cooldown: pulumi.String("PT1M"),
},
},
},
FixedDate: &monitoring.AutoscaleSettingProfileFixedDateArgs{
Timezone: pulumi.String("Pacific Standard Time"),
Start: pulumi.String("2020-07-01T00:00:00Z"),
End: pulumi.String("2020-07-31T23:59:59Z"),
},
},
},
Notification: &monitoring.AutoscaleSettingNotificationArgs{
Email: &monitoring.AutoscaleSettingNotificationEmailArgs{
SendToSubscriptionAdministrator: pulumi.Bool(true),
SendToSubscriptionCoAdministrator: pulumi.Bool(true),
CustomEmails: pulumi.StringArray{
pulumi.String("admin@contoso.com"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "autoscalingTest",
Location = "West Europe",
});
var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
{
Name = "acctvn",
AddressSpaces = new[]
{
"10.0.0.0/16",
},
Location = example.Location,
ResourceGroupName = example.Name,
});
var exampleSubnet = new Azure.Network.Subnet("example", new()
{
Name = "acctsub",
ResourceGroupName = example.Name,
VirtualNetworkName = exampleVirtualNetwork.Name,
AddressPrefixes = new[]
{
"10.0.2.0/24",
},
});
var exampleLinuxVirtualMachineScaleSet = new Azure.Compute.LinuxVirtualMachineScaleSet("example", new()
{
Name = "exampleset",
Location = example.Location,
ResourceGroupName = example.Name,
UpgradeMode = "Manual",
Sku = "Standard_F2",
Instances = 2,
AdminUsername = "myadmin",
AdminSshKeys = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs
{
Username = "myadmin",
PublicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com",
},
},
NetworkInterfaces = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs
{
Name = "TestNetworkProfile",
Primary = true,
IpConfigurations = new[]
{
new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs
{
Name = "TestIPConfiguration",
Primary = true,
SubnetId = exampleSubnet.Id,
},
},
},
},
OsDisk = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetOsDiskArgs
{
Caching = "ReadWrite",
StorageAccountType = "StandardSSD_LRS",
},
SourceImageReference = new Azure.Compute.Inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs
{
Publisher = "Canonical",
Offer = "0001-com-ubuntu-server-jammy",
Sku = "22_04-lts",
Version = "latest",
},
});
var exampleAutoscaleSetting = new Azure.Monitoring.AutoscaleSetting("example", new()
{
Name = "myAutoscaleSetting",
Enabled = true,
ResourceGroupName = example.Name,
Location = example.Location,
TargetResourceId = exampleLinuxVirtualMachineScaleSet.Id,
Profiles = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileArgs
{
Name = "forJuly",
Capacity = new Azure.Monitoring.Inputs.AutoscaleSettingProfileCapacityArgs
{
Default = 1,
Minimum = 1,
Maximum = 10,
},
Rules = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleArgs
{
MetricTrigger = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerArgs
{
MetricName = "Percentage CPU",
MetricResourceId = exampleLinuxVirtualMachineScaleSet.Id,
TimeGrain = "PT1M",
Statistic = "Average",
TimeWindow = "PT5M",
TimeAggregation = "Average",
Operator = "GreaterThan",
Threshold = 90,
},
ScaleAction = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleScaleActionArgs
{
Direction = "Increase",
Type = "ChangeCount",
Value = 2,
Cooldown = "PT1M",
},
},
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleArgs
{
MetricTrigger = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerArgs
{
MetricName = "Percentage CPU",
MetricResourceId = exampleLinuxVirtualMachineScaleSet.Id,
TimeGrain = "PT1M",
Statistic = "Average",
TimeWindow = "PT5M",
TimeAggregation = "Average",
Operator = "LessThan",
Threshold = 10,
},
ScaleAction = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleScaleActionArgs
{
Direction = "Decrease",
Type = "ChangeCount",
Value = 2,
Cooldown = "PT1M",
},
},
},
FixedDate = new Azure.Monitoring.Inputs.AutoscaleSettingProfileFixedDateArgs
{
Timezone = "Pacific Standard Time",
Start = "2020-07-01T00:00:00Z",
End = "2020-07-31T23:59:59Z",
},
},
},
Notification = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationArgs
{
Email = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationEmailArgs
{
SendToSubscriptionAdministrator = true,
SendToSubscriptionCoAdministrator = true,
CustomEmails = new[]
{
"admin@contoso.com",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.network.VirtualNetwork;
import com.pulumi.azure.network.VirtualNetworkArgs;
import com.pulumi.azure.network.Subnet;
import com.pulumi.azure.network.SubnetArgs;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSet;
import com.pulumi.azure.compute.LinuxVirtualMachineScaleSetArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetAdminSshKeyArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetNetworkInterfaceArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetOsDiskArgs;
import com.pulumi.azure.compute.inputs.LinuxVirtualMachineScaleSetSourceImageReferenceArgs;
import com.pulumi.azure.monitoring.AutoscaleSetting;
import com.pulumi.azure.monitoring.AutoscaleSettingArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileCapacityArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingProfileFixedDateArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingNotificationArgs;
import com.pulumi.azure.monitoring.inputs.AutoscaleSettingNotificationEmailArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("autoscalingTest")
.location("West Europe")
.build());
var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
.name("acctvn")
.addressSpaces("10.0.0.0/16")
.location(example.location())
.resourceGroupName(example.name())
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.name("acctsub")
.resourceGroupName(example.name())
.virtualNetworkName(exampleVirtualNetwork.name())
.addressPrefixes("10.0.2.0/24")
.build());
var exampleLinuxVirtualMachineScaleSet = new LinuxVirtualMachineScaleSet("exampleLinuxVirtualMachineScaleSet", LinuxVirtualMachineScaleSetArgs.builder()
.name("exampleset")
.location(example.location())
.resourceGroupName(example.name())
.upgradeMode("Manual")
.sku("Standard_F2")
.instances(2)
.adminUsername("myadmin")
.adminSshKeys(LinuxVirtualMachineScaleSetAdminSshKeyArgs.builder()
.username("myadmin")
.publicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com")
.build())
.networkInterfaces(LinuxVirtualMachineScaleSetNetworkInterfaceArgs.builder()
.name("TestNetworkProfile")
.primary(true)
.ipConfigurations(LinuxVirtualMachineScaleSetNetworkInterfaceIpConfigurationArgs.builder()
.name("TestIPConfiguration")
.primary(true)
.subnetId(exampleSubnet.id())
.build())
.build())
.osDisk(LinuxVirtualMachineScaleSetOsDiskArgs.builder()
.caching("ReadWrite")
.storageAccountType("StandardSSD_LRS")
.build())
.sourceImageReference(LinuxVirtualMachineScaleSetSourceImageReferenceArgs.builder()
.publisher("Canonical")
.offer("0001-com-ubuntu-server-jammy")
.sku("22_04-lts")
.version("latest")
.build())
.build());
var exampleAutoscaleSetting = new AutoscaleSetting("exampleAutoscaleSetting", AutoscaleSettingArgs.builder()
.name("myAutoscaleSetting")
.enabled(true)
.resourceGroupName(example.name())
.location(example.location())
.targetResourceId(exampleLinuxVirtualMachineScaleSet.id())
.profiles(AutoscaleSettingProfileArgs.builder()
.name("forJuly")
.capacity(AutoscaleSettingProfileCapacityArgs.builder()
.default_(1)
.minimum(1)
.maximum(10)
.build())
.rules(
AutoscaleSettingProfileRuleArgs.builder()
.metricTrigger(AutoscaleSettingProfileRuleMetricTriggerArgs.builder()
.metricName("Percentage CPU")
.metricResourceId(exampleLinuxVirtualMachineScaleSet.id())
.timeGrain("PT1M")
.statistic("Average")
.timeWindow("PT5M")
.timeAggregation("Average")
.operator("GreaterThan")
.threshold(90)
.build())
.scaleAction(AutoscaleSettingProfileRuleScaleActionArgs.builder()
.direction("Increase")
.type("ChangeCount")
.value("2")
.cooldown("PT1M")
.build())
.build(),
AutoscaleSettingProfileRuleArgs.builder()
.metricTrigger(AutoscaleSettingProfileRuleMetricTriggerArgs.builder()
.metricName("Percentage CPU")
.metricResourceId(exampleLinuxVirtualMachineScaleSet.id())
.timeGrain("PT1M")
.statistic("Average")
.timeWindow("PT5M")
.timeAggregation("Average")
.operator("LessThan")
.threshold(10)
.build())
.scaleAction(AutoscaleSettingProfileRuleScaleActionArgs.builder()
.direction("Decrease")
.type("ChangeCount")
.value("2")
.cooldown("PT1M")
.build())
.build())
.fixedDate(AutoscaleSettingProfileFixedDateArgs.builder()
.timezone("Pacific Standard Time")
.start("2020-07-01T00:00:00Z")
.end("2020-07-31T23:59:59Z")
.build())
.build())
.notification(AutoscaleSettingNotificationArgs.builder()
.email(AutoscaleSettingNotificationEmailArgs.builder()
.sendToSubscriptionAdministrator(true)
.sendToSubscriptionCoAdministrator(true)
.customEmails("admin@contoso.com")
.build())
.build())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: autoscalingTest
location: West Europe
exampleVirtualNetwork:
type: azure:network:VirtualNetwork
name: example
properties:
name: acctvn
addressSpaces:
- 10.0.0.0/16
location: ${example.location}
resourceGroupName: ${example.name}
exampleSubnet:
type: azure:network:Subnet
name: example
properties:
name: acctsub
resourceGroupName: ${example.name}
virtualNetworkName: ${exampleVirtualNetwork.name}
addressPrefixes:
- 10.0.2.0/24
exampleLinuxVirtualMachineScaleSet:
type: azure:compute:LinuxVirtualMachineScaleSet
name: example
properties:
name: exampleset
location: ${example.location}
resourceGroupName: ${example.name}
upgradeMode: Manual
sku: Standard_F2
instances: 2
adminUsername: myadmin
adminSshKeys:
- username: myadmin
publicKey: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDCsTcryUl51Q2VSEHqDRNmceUFo55ZtcIwxl2QITbN1RREti5ml/VTytC0yeBOvnZA4x4CFpdw/lCDPk0yrH9Ei5vVkXmOrExdTlT3qI7YaAzj1tUVlBd4S6LX1F7y6VLActvdHuDDuXZXzCDd/97420jrDfWZqJMlUK/EmCE5ParCeHIRIvmBxcEnGfFIsw8xQZl0HphxWOtJil8qsUWSdMyCiJYYQpMoMliO99X40AUc4/AlsyPyT5ddbKk08YrZ+rKDVHF7o29rh4vi5MmHkVgVQHKiKybWlHq+b71gIAUQk9wrJxD+dqt4igrmDSpIjfjwnd+l5UIn5fJSO5DYV4YT/4hwK7OKmuo7OFHD0WyY5YnkYEMtFgzemnRBdE8ulcT60DQpVgRMXFWHvhyCWy0L6sgj1QWDZlLpvsIvNfHsyhKFMG1frLnMt/nP0+YCcfg+v1JYeCKjeoJxB8DWcRBsjzItY0CGmzP8UYZiYKl/2u+2TgFS5r7NWH11bxoUzjKdaa1NLw+ieA8GlBFfCbfWe6YVB9ggUte4VtYFMZGxOjS2bAiYtfgTKFJv+XqORAwExG6+G2eDxIDyo80/OA9IG7Xv/jwQr7D6KDjDuULFcN/iTxuttoKrHeYz1hf5ZQlBdllwJHYx6fK2g8kha6r2JIQKocvsAXiiONqSfw== hello@world.com
networkInterfaces:
- name: TestNetworkProfile
primary: true
ipConfigurations:
- name: TestIPConfiguration
primary: true
subnetId: ${exampleSubnet.id}
osDisk:
caching: ReadWrite
storageAccountType: StandardSSD_LRS
sourceImageReference:
publisher: Canonical
offer: 0001-com-ubuntu-server-jammy
sku: 22_04-lts
version: latest
exampleAutoscaleSetting:
type: azure:monitoring:AutoscaleSetting
name: example
properties:
name: myAutoscaleSetting
enabled: true
resourceGroupName: ${example.name}
location: ${example.location}
targetResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
profiles:
- name: forJuly
capacity:
default: 1
minimum: 1
maximum: 10
rules:
- metricTrigger:
metricName: Percentage CPU
metricResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
timeGrain: PT1M
statistic: Average
timeWindow: PT5M
timeAggregation: Average
operator: GreaterThan
threshold: 90
scaleAction:
direction: Increase
type: ChangeCount
value: '2'
cooldown: PT1M
- metricTrigger:
metricName: Percentage CPU
metricResourceId: ${exampleLinuxVirtualMachineScaleSet.id}
timeGrain: PT1M
statistic: Average
timeWindow: PT5M
timeAggregation: Average
operator: LessThan
threshold: 10
scaleAction:
direction: Decrease
type: ChangeCount
value: '2'
cooldown: PT1M
fixedDate:
timezone: Pacific Standard Time
start: 2020-07-01T00:00:00Z
end: 2020-07-31T23:59:59Z
notification:
email:
sendToSubscriptionAdministrator: true
sendToSubscriptionCoAdministrator: true
customEmails:
- admin@contoso.com
Create AutoscaleSetting Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new AutoscaleSetting(name: string, args: AutoscaleSettingArgs, opts?: CustomResourceOptions);
@overload
def AutoscaleSetting(resource_name: str,
args: AutoscaleSettingArgs,
opts: Optional[ResourceOptions] = None)
@overload
def AutoscaleSetting(resource_name: str,
opts: Optional[ResourceOptions] = None,
profiles: Optional[Sequence[AutoscaleSettingProfileArgs]] = None,
resource_group_name: Optional[str] = None,
target_resource_id: Optional[str] = None,
enabled: Optional[bool] = None,
location: Optional[str] = None,
name: Optional[str] = None,
notification: Optional[AutoscaleSettingNotificationArgs] = None,
predictive: Optional[AutoscaleSettingPredictiveArgs] = None,
tags: Optional[Mapping[str, str]] = None)
func NewAutoscaleSetting(ctx *Context, name string, args AutoscaleSettingArgs, opts ...ResourceOption) (*AutoscaleSetting, error)
public AutoscaleSetting(string name, AutoscaleSettingArgs args, CustomResourceOptions? opts = null)
public AutoscaleSetting(String name, AutoscaleSettingArgs args)
public AutoscaleSetting(String name, AutoscaleSettingArgs args, CustomResourceOptions options)
type: azure:monitoring:AutoscaleSetting
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args AutoscaleSettingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AutoscaleSettingArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AutoscaleSettingArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AutoscaleSettingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AutoscaleSettingArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var autoscaleSettingResource = new Azure.Monitoring.AutoscaleSetting("autoscaleSettingResource", new()
{
Profiles = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileArgs
{
Capacity = new Azure.Monitoring.Inputs.AutoscaleSettingProfileCapacityArgs
{
Default = 0,
Maximum = 0,
Minimum = 0,
},
Name = "string",
FixedDate = new Azure.Monitoring.Inputs.AutoscaleSettingProfileFixedDateArgs
{
End = "string",
Start = "string",
Timezone = "string",
},
Recurrence = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRecurrenceArgs
{
Days = new[]
{
"string",
},
Hours = 0,
Minutes = 0,
Timezone = "string",
},
Rules = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleArgs
{
MetricTrigger = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerArgs
{
MetricName = "string",
MetricResourceId = "string",
Operator = "string",
Statistic = "string",
Threshold = 0,
TimeAggregation = "string",
TimeGrain = "string",
TimeWindow = "string",
Dimensions = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleMetricTriggerDimensionArgs
{
Name = "string",
Operator = "string",
Values = new[]
{
"string",
},
},
},
DivideByInstanceCount = false,
MetricNamespace = "string",
},
ScaleAction = new Azure.Monitoring.Inputs.AutoscaleSettingProfileRuleScaleActionArgs
{
Cooldown = "string",
Direction = "string",
Type = "string",
Value = 0,
},
},
},
},
},
ResourceGroupName = "string",
TargetResourceId = "string",
Enabled = false,
Location = "string",
Name = "string",
Notification = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationArgs
{
Email = new Azure.Monitoring.Inputs.AutoscaleSettingNotificationEmailArgs
{
CustomEmails = new[]
{
"string",
},
SendToSubscriptionAdministrator = false,
SendToSubscriptionCoAdministrator = false,
},
Webhooks = new[]
{
new Azure.Monitoring.Inputs.AutoscaleSettingNotificationWebhookArgs
{
ServiceUri = "string",
Properties =
{
{ "string", "string" },
},
},
},
},
Predictive = new Azure.Monitoring.Inputs.AutoscaleSettingPredictiveArgs
{
ScaleMode = "string",
LookAheadTime = "string",
},
Tags =
{
{ "string", "string" },
},
});
example, err := monitoring.NewAutoscaleSetting(ctx, "autoscaleSettingResource", &monitoring.AutoscaleSettingArgs{
Profiles: monitoring.AutoscaleSettingProfileArray{
&monitoring.AutoscaleSettingProfileArgs{
Capacity: &monitoring.AutoscaleSettingProfileCapacityArgs{
Default: pulumi.Int(0),
Maximum: pulumi.Int(0),
Minimum: pulumi.Int(0),
},
Name: pulumi.String("string"),
FixedDate: &monitoring.AutoscaleSettingProfileFixedDateArgs{
End: pulumi.String("string"),
Start: pulumi.String("string"),
Timezone: pulumi.String("string"),
},
Recurrence: &monitoring.AutoscaleSettingProfileRecurrenceArgs{
Days: pulumi.StringArray{
pulumi.String("string"),
},
Hours: pulumi.Int(0),
Minutes: pulumi.Int(0),
Timezone: pulumi.String("string"),
},
Rules: monitoring.AutoscaleSettingProfileRuleArray{
&monitoring.AutoscaleSettingProfileRuleArgs{
MetricTrigger: &monitoring.AutoscaleSettingProfileRuleMetricTriggerArgs{
MetricName: pulumi.String("string"),
MetricResourceId: pulumi.String("string"),
Operator: pulumi.String("string"),
Statistic: pulumi.String("string"),
Threshold: pulumi.Float64(0),
TimeAggregation: pulumi.String("string"),
TimeGrain: pulumi.String("string"),
TimeWindow: pulumi.String("string"),
Dimensions: monitoring.AutoscaleSettingProfileRuleMetricTriggerDimensionArray{
&monitoring.AutoscaleSettingProfileRuleMetricTriggerDimensionArgs{
Name: pulumi.String("string"),
Operator: pulumi.String("string"),
Values: pulumi.StringArray{
pulumi.String("string"),
},
},
},
DivideByInstanceCount: pulumi.Bool(false),
MetricNamespace: pulumi.String("string"),
},
ScaleAction: &monitoring.AutoscaleSettingProfileRuleScaleActionArgs{
Cooldown: pulumi.String("string"),
Direction: pulumi.String("string"),
Type: pulumi.String("string"),
Value: pulumi.Int(0),
},
},
},
},
},
ResourceGroupName: pulumi.String("string"),
TargetResourceId: pulumi.String("string"),
Enabled: pulumi.Bool(false),
Location: pulumi.String("string"),
Name: pulumi.String("string"),
Notification: &monitoring.AutoscaleSettingNotificationArgs{
Email: &monitoring.AutoscaleSettingNotificationEmailArgs{
CustomEmails: pulumi.StringArray{
pulumi.String("string"),
},
SendToSubscriptionAdministrator: pulumi.Bool(false),
SendToSubscriptionCoAdministrator: pulumi.Bool(false),
},
Webhooks: monitoring.AutoscaleSettingNotificationWebhookArray{
&monitoring.AutoscaleSettingNotificationWebhookArgs{
ServiceUri: pulumi.String("string"),
Properties: pulumi.StringMap{
"string": pulumi.String("string"),
},
},
},
},
Predictive: &monitoring.AutoscaleSettingPredictiveArgs{
ScaleMode: pulumi.String("string"),
LookAheadTime: pulumi.String("string"),
},
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var autoscaleSettingResource = new AutoscaleSetting("autoscaleSettingResource", AutoscaleSettingArgs.builder()
.profiles(AutoscaleSettingProfileArgs.builder()
.capacity(AutoscaleSettingProfileCapacityArgs.builder()
.default_(0)
.maximum(0)
.minimum(0)
.build())
.name("string")
.fixedDate(AutoscaleSettingProfileFixedDateArgs.builder()
.end("string")
.start("string")
.timezone("string")
.build())
.recurrence(AutoscaleSettingProfileRecurrenceArgs.builder()
.days("string")
.hours(0)
.minutes(0)
.timezone("string")
.build())
.rules(AutoscaleSettingProfileRuleArgs.builder()
.metricTrigger(AutoscaleSettingProfileRuleMetricTriggerArgs.builder()
.metricName("string")
.metricResourceId("string")
.operator("string")
.statistic("string")
.threshold(0)
.timeAggregation("string")
.timeGrain("string")
.timeWindow("string")
.dimensions(AutoscaleSettingProfileRuleMetricTriggerDimensionArgs.builder()
.name("string")
.operator("string")
.values("string")
.build())
.divideByInstanceCount(false)
.metricNamespace("string")
.build())
.scaleAction(AutoscaleSettingProfileRuleScaleActionArgs.builder()
.cooldown("string")
.direction("string")
.type("string")
.value(0)
.build())
.build())
.build())
.resourceGroupName("string")
.targetResourceId("string")
.enabled(false)
.location("string")
.name("string")
.notification(AutoscaleSettingNotificationArgs.builder()
.email(AutoscaleSettingNotificationEmailArgs.builder()
.customEmails("string")
.sendToSubscriptionAdministrator(false)
.sendToSubscriptionCoAdministrator(false)
.build())
.webhooks(AutoscaleSettingNotificationWebhookArgs.builder()
.serviceUri("string")
.properties(Map.of("string", "string"))
.build())
.build())
.predictive(AutoscaleSettingPredictiveArgs.builder()
.scaleMode("string")
.lookAheadTime("string")
.build())
.tags(Map.of("string", "string"))
.build());
autoscale_setting_resource = azure.monitoring.AutoscaleSetting("autoscaleSettingResource",
profiles=[{
"capacity": {
"default": 0,
"maximum": 0,
"minimum": 0,
},
"name": "string",
"fixed_date": {
"end": "string",
"start": "string",
"timezone": "string",
},
"recurrence": {
"days": ["string"],
"hours": 0,
"minutes": 0,
"timezone": "string",
},
"rules": [{
"metric_trigger": {
"metric_name": "string",
"metric_resource_id": "string",
"operator": "string",
"statistic": "string",
"threshold": 0,
"time_aggregation": "string",
"time_grain": "string",
"time_window": "string",
"dimensions": [{
"name": "string",
"operator": "string",
"values": ["string"],
}],
"divide_by_instance_count": False,
"metric_namespace": "string",
},
"scale_action": {
"cooldown": "string",
"direction": "string",
"type": "string",
"value": 0,
},
}],
}],
resource_group_name="string",
target_resource_id="string",
enabled=False,
location="string",
name="string",
notification={
"email": {
"custom_emails": ["string"],
"send_to_subscription_administrator": False,
"send_to_subscription_co_administrator": False,
},
"webhooks": [{
"service_uri": "string",
"properties": {
"string": "string",
},
}],
},
predictive={
"scale_mode": "string",
"look_ahead_time": "string",
},
tags={
"string": "string",
})
const autoscaleSettingResource = new azure.monitoring.AutoscaleSetting("autoscaleSettingResource", {
profiles: [{
capacity: {
"default": 0,
maximum: 0,
minimum: 0,
},
name: "string",
fixedDate: {
end: "string",
start: "string",
timezone: "string",
},
recurrence: {
days: ["string"],
hours: 0,
minutes: 0,
timezone: "string",
},
rules: [{
metricTrigger: {
metricName: "string",
metricResourceId: "string",
operator: "string",
statistic: "string",
threshold: 0,
timeAggregation: "string",
timeGrain: "string",
timeWindow: "string",
dimensions: [{
name: "string",
operator: "string",
values: ["string"],
}],
divideByInstanceCount: false,
metricNamespace: "string",
},
scaleAction: {
cooldown: "string",
direction: "string",
type: "string",
value: 0,
},
}],
}],
resourceGroupName: "string",
targetResourceId: "string",
enabled: false,
location: "string",
name: "string",
notification: {
email: {
customEmails: ["string"],
sendToSubscriptionAdministrator: false,
sendToSubscriptionCoAdministrator: false,
},
webhooks: [{
serviceUri: "string",
properties: {
string: "string",
},
}],
},
predictive: {
scaleMode: "string",
lookAheadTime: "string",
},
tags: {
string: "string",
},
});
type: azure:monitoring:AutoscaleSetting
properties:
enabled: false
location: string
name: string
notification:
email:
customEmails:
- string
sendToSubscriptionAdministrator: false
sendToSubscriptionCoAdministrator: false
webhooks:
- properties:
string: string
serviceUri: string
predictive:
lookAheadTime: string
scaleMode: string
profiles:
- capacity:
default: 0
maximum: 0
minimum: 0
fixedDate:
end: string
start: string
timezone: string
name: string
recurrence:
days:
- string
hours: 0
minutes: 0
timezone: string
rules:
- metricTrigger:
dimensions:
- name: string
operator: string
values:
- string
divideByInstanceCount: false
metricName: string
metricNamespace: string
metricResourceId: string
operator: string
statistic: string
threshold: 0
timeAggregation: string
timeGrain: string
timeWindow: string
scaleAction:
cooldown: string
direction: string
type: string
value: 0
resourceGroupName: string
tags:
string: string
targetResourceId: string
AutoscaleSetting Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The AutoscaleSetting resource accepts the following input properties:
- Profiles
List<Autoscale
Setting Profile> - Specifies one or more (up to 20)
profile
blocks as defined below. - Resource
Group stringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- Target
Resource stringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- Enabled bool
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - Location string
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- Name string
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- Notification
Autoscale
Setting Notification - Specifies a
notification
block as defined below. - Predictive
Autoscale
Setting Predictive - A
predictive
block as defined below. - Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Profiles
[]Autoscale
Setting Profile Args - Specifies one or more (up to 20)
profile
blocks as defined below. - Resource
Group stringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- Target
Resource stringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- Enabled bool
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - Location string
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- Name string
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- Notification
Autoscale
Setting Notification Args - Specifies a
notification
block as defined below. - Predictive
Autoscale
Setting Predictive Args - A
predictive
block as defined below. - map[string]string
- A mapping of tags to assign to the resource.
- profiles
List<Autoscale
Setting Profile> - Specifies one or more (up to 20)
profile
blocks as defined below. - resource
Group StringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- target
Resource StringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled Boolean
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location String
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name String
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification
Autoscale
Setting Notification - Specifies a
notification
block as defined below. - predictive
Autoscale
Setting Predictive - A
predictive
block as defined below. - Map<String,String>
- A mapping of tags to assign to the resource.
- profiles
Autoscale
Setting Profile[] - Specifies one or more (up to 20)
profile
blocks as defined below. - resource
Group stringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- target
Resource stringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled boolean
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location string
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name string
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification
Autoscale
Setting Notification - Specifies a
notification
block as defined below. - predictive
Autoscale
Setting Predictive - A
predictive
block as defined below. - {[key: string]: string}
- A mapping of tags to assign to the resource.
- profiles
Sequence[Autoscale
Setting Profile Args] - Specifies one or more (up to 20)
profile
blocks as defined below. - resource_
group_ strname - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- target_
resource_ strid - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled bool
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location str
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name str
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification
Autoscale
Setting Notification Args - Specifies a
notification
block as defined below. - predictive
Autoscale
Setting Predictive Args - A
predictive
block as defined below. - Mapping[str, str]
- A mapping of tags to assign to the resource.
- profiles List<Property Map>
- Specifies one or more (up to 20)
profile
blocks as defined below. - resource
Group StringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- target
Resource StringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled Boolean
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location String
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name String
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification Property Map
- Specifies a
notification
block as defined below. - predictive Property Map
- A
predictive
block as defined below. - Map<String>
- A mapping of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the AutoscaleSetting resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing AutoscaleSetting Resource
Get an existing AutoscaleSetting resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AutoscaleSettingState, opts?: CustomResourceOptions): AutoscaleSetting
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
enabled: Optional[bool] = None,
location: Optional[str] = None,
name: Optional[str] = None,
notification: Optional[AutoscaleSettingNotificationArgs] = None,
predictive: Optional[AutoscaleSettingPredictiveArgs] = None,
profiles: Optional[Sequence[AutoscaleSettingProfileArgs]] = None,
resource_group_name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
target_resource_id: Optional[str] = None) -> AutoscaleSetting
func GetAutoscaleSetting(ctx *Context, name string, id IDInput, state *AutoscaleSettingState, opts ...ResourceOption) (*AutoscaleSetting, error)
public static AutoscaleSetting Get(string name, Input<string> id, AutoscaleSettingState? state, CustomResourceOptions? opts = null)
public static AutoscaleSetting get(String name, Output<String> id, AutoscaleSettingState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Enabled bool
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - Location string
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- Name string
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- Notification
Autoscale
Setting Notification - Specifies a
notification
block as defined below. - Predictive
Autoscale
Setting Predictive - A
predictive
block as defined below. - Profiles
List<Autoscale
Setting Profile> - Specifies one or more (up to 20)
profile
blocks as defined below. - Resource
Group stringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- Target
Resource stringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- Enabled bool
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - Location string
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- Name string
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- Notification
Autoscale
Setting Notification Args - Specifies a
notification
block as defined below. - Predictive
Autoscale
Setting Predictive Args - A
predictive
block as defined below. - Profiles
[]Autoscale
Setting Profile Args - Specifies one or more (up to 20)
profile
blocks as defined below. - Resource
Group stringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- map[string]string
- A mapping of tags to assign to the resource.
- Target
Resource stringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled Boolean
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location String
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name String
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification
Autoscale
Setting Notification - Specifies a
notification
block as defined below. - predictive
Autoscale
Setting Predictive - A
predictive
block as defined below. - profiles
List<Autoscale
Setting Profile> - Specifies one or more (up to 20)
profile
blocks as defined below. - resource
Group StringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- Map<String,String>
- A mapping of tags to assign to the resource.
- target
Resource StringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled boolean
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location string
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name string
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification
Autoscale
Setting Notification - Specifies a
notification
block as defined below. - predictive
Autoscale
Setting Predictive - A
predictive
block as defined below. - profiles
Autoscale
Setting Profile[] - Specifies one or more (up to 20)
profile
blocks as defined below. - resource
Group stringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- target
Resource stringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled bool
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location str
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name str
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification
Autoscale
Setting Notification Args - Specifies a
notification
block as defined below. - predictive
Autoscale
Setting Predictive Args - A
predictive
block as defined below. - profiles
Sequence[Autoscale
Setting Profile Args] - Specifies one or more (up to 20)
profile
blocks as defined below. - resource_
group_ strname - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- target_
resource_ strid - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
- enabled Boolean
- Specifies whether automatic scaling is enabled for the target resource. Defaults to
true
. - location String
- Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.
- name String
- The name of the AutoScale Setting. Changing this forces a new resource to be created.
- notification Property Map
- Specifies a
notification
block as defined below. - predictive Property Map
- A
predictive
block as defined below. - profiles List<Property Map>
- Specifies one or more (up to 20)
profile
blocks as defined below. - resource
Group StringName - The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.
- Map<String>
- A mapping of tags to assign to the resource.
- target
Resource StringId - Specifies the resource ID of the resource that the autoscale setting should be added to. Changing this forces a new resource to be created.
Supporting Types
AutoscaleSettingNotification, AutoscaleSettingNotificationArgs
- Email
Autoscale
Setting Notification Email - A
email
block as defined below. - Webhooks
List<Autoscale
Setting Notification Webhook> - One or more
webhook
blocks as defined below.
- Email
Autoscale
Setting Notification Email - A
email
block as defined below. - Webhooks
[]Autoscale
Setting Notification Webhook - One or more
webhook
blocks as defined below.
- email
Autoscale
Setting Notification Email - A
email
block as defined below. - webhooks
List<Autoscale
Setting Notification Webhook> - One or more
webhook
blocks as defined below.
- email
Autoscale
Setting Notification Email - A
email
block as defined below. - webhooks
Autoscale
Setting Notification Webhook[] - One or more
webhook
blocks as defined below.
- email
Autoscale
Setting Notification Email - A
email
block as defined below. - webhooks
Sequence[Autoscale
Setting Notification Webhook] - One or more
webhook
blocks as defined below.
- email Property Map
- A
email
block as defined below. - webhooks List<Property Map>
- One or more
webhook
blocks as defined below.
AutoscaleSettingNotificationEmail, AutoscaleSettingNotificationEmailArgs
- Custom
Emails List<string> - Specifies a list of custom email addresses to which the email notifications will be sent.
- Send
To boolSubscription Administrator - Should email notifications be sent to the subscription administrator? Defaults to
false
. - Send
To boolSubscription Co Administrator - Should email notifications be sent to the subscription co-administrator? Defaults to
false
.
- Custom
Emails []string - Specifies a list of custom email addresses to which the email notifications will be sent.
- Send
To boolSubscription Administrator - Should email notifications be sent to the subscription administrator? Defaults to
false
. - Send
To boolSubscription Co Administrator - Should email notifications be sent to the subscription co-administrator? Defaults to
false
.
- custom
Emails List<String> - Specifies a list of custom email addresses to which the email notifications will be sent.
- send
To BooleanSubscription Administrator - Should email notifications be sent to the subscription administrator? Defaults to
false
. - send
To BooleanSubscription Co Administrator - Should email notifications be sent to the subscription co-administrator? Defaults to
false
.
- custom
Emails string[] - Specifies a list of custom email addresses to which the email notifications will be sent.
- send
To booleanSubscription Administrator - Should email notifications be sent to the subscription administrator? Defaults to
false
. - send
To booleanSubscription Co Administrator - Should email notifications be sent to the subscription co-administrator? Defaults to
false
.
- custom_
emails Sequence[str] - Specifies a list of custom email addresses to which the email notifications will be sent.
- send_
to_ boolsubscription_ administrator - Should email notifications be sent to the subscription administrator? Defaults to
false
. - send_
to_ boolsubscription_ co_ administrator - Should email notifications be sent to the subscription co-administrator? Defaults to
false
.
- custom
Emails List<String> - Specifies a list of custom email addresses to which the email notifications will be sent.
- send
To BooleanSubscription Administrator - Should email notifications be sent to the subscription administrator? Defaults to
false
. - send
To BooleanSubscription Co Administrator - Should email notifications be sent to the subscription co-administrator? Defaults to
false
.
AutoscaleSettingNotificationWebhook, AutoscaleSettingNotificationWebhookArgs
- Service
Uri string - The HTTPS URI which should receive scale notifications.
- Properties Dictionary<string, string>
- A map of settings.
- Service
Uri string - The HTTPS URI which should receive scale notifications.
- Properties map[string]string
- A map of settings.
- service
Uri String - The HTTPS URI which should receive scale notifications.
- properties Map<String,String>
- A map of settings.
- service
Uri string - The HTTPS URI which should receive scale notifications.
- properties {[key: string]: string}
- A map of settings.
- service_
uri str - The HTTPS URI which should receive scale notifications.
- properties Mapping[str, str]
- A map of settings.
- service
Uri String - The HTTPS URI which should receive scale notifications.
- properties Map<String>
- A map of settings.
AutoscaleSettingPredictive, AutoscaleSettingPredictiveArgs
- Scale
Mode string - Specifies the predictive scale mode. Possible values are
Enabled
orForecastOnly
. - Look
Ahead stringTime - Specifies the amount of time by which instances are launched in advance. It must be between
PT1M
andPT1H
in ISO 8601 format.
- Scale
Mode string - Specifies the predictive scale mode. Possible values are
Enabled
orForecastOnly
. - Look
Ahead stringTime - Specifies the amount of time by which instances are launched in advance. It must be between
PT1M
andPT1H
in ISO 8601 format.
- scale
Mode String - Specifies the predictive scale mode. Possible values are
Enabled
orForecastOnly
. - look
Ahead StringTime - Specifies the amount of time by which instances are launched in advance. It must be between
PT1M
andPT1H
in ISO 8601 format.
- scale
Mode string - Specifies the predictive scale mode. Possible values are
Enabled
orForecastOnly
. - look
Ahead stringTime - Specifies the amount of time by which instances are launched in advance. It must be between
PT1M
andPT1H
in ISO 8601 format.
- scale_
mode str - Specifies the predictive scale mode. Possible values are
Enabled
orForecastOnly
. - look_
ahead_ strtime - Specifies the amount of time by which instances are launched in advance. It must be between
PT1M
andPT1H
in ISO 8601 format.
- scale
Mode String - Specifies the predictive scale mode. Possible values are
Enabled
orForecastOnly
. - look
Ahead StringTime - Specifies the amount of time by which instances are launched in advance. It must be between
PT1M
andPT1H
in ISO 8601 format.
AutoscaleSettingProfile, AutoscaleSettingProfileArgs
- Capacity
Autoscale
Setting Profile Capacity - A
capacity
block as defined below. - Name string
- Specifies the name of the profile.
- Fixed
Date AutoscaleSetting Profile Fixed Date - A
fixed_date
block as defined below. This cannot be specified if arecurrence
block is specified. - Recurrence
Autoscale
Setting Profile Recurrence - A
recurrence
block as defined below. This cannot be specified if afixed_date
block is specified. - Rules
List<Autoscale
Setting Profile Rule> - One or more (up to 10)
rule
blocks as defined below.
- Capacity
Autoscale
Setting Profile Capacity - A
capacity
block as defined below. - Name string
- Specifies the name of the profile.
- Fixed
Date AutoscaleSetting Profile Fixed Date - A
fixed_date
block as defined below. This cannot be specified if arecurrence
block is specified. - Recurrence
Autoscale
Setting Profile Recurrence - A
recurrence
block as defined below. This cannot be specified if afixed_date
block is specified. - Rules
[]Autoscale
Setting Profile Rule - One or more (up to 10)
rule
blocks as defined below.
- capacity
Autoscale
Setting Profile Capacity - A
capacity
block as defined below. - name String
- Specifies the name of the profile.
- fixed
Date AutoscaleSetting Profile Fixed Date - A
fixed_date
block as defined below. This cannot be specified if arecurrence
block is specified. - recurrence
Autoscale
Setting Profile Recurrence - A
recurrence
block as defined below. This cannot be specified if afixed_date
block is specified. - rules
List<Autoscale
Setting Profile Rule> - One or more (up to 10)
rule
blocks as defined below.
- capacity
Autoscale
Setting Profile Capacity - A
capacity
block as defined below. - name string
- Specifies the name of the profile.
- fixed
Date AutoscaleSetting Profile Fixed Date - A
fixed_date
block as defined below. This cannot be specified if arecurrence
block is specified. - recurrence
Autoscale
Setting Profile Recurrence - A
recurrence
block as defined below. This cannot be specified if afixed_date
block is specified. - rules
Autoscale
Setting Profile Rule[] - One or more (up to 10)
rule
blocks as defined below.
- capacity
Autoscale
Setting Profile Capacity - A
capacity
block as defined below. - name str
- Specifies the name of the profile.
- fixed_
date AutoscaleSetting Profile Fixed Date - A
fixed_date
block as defined below. This cannot be specified if arecurrence
block is specified. - recurrence
Autoscale
Setting Profile Recurrence - A
recurrence
block as defined below. This cannot be specified if afixed_date
block is specified. - rules
Sequence[Autoscale
Setting Profile Rule] - One or more (up to 10)
rule
blocks as defined below.
- capacity Property Map
- A
capacity
block as defined below. - name String
- Specifies the name of the profile.
- fixed
Date Property Map - A
fixed_date
block as defined below. This cannot be specified if arecurrence
block is specified. - recurrence Property Map
- A
recurrence
block as defined below. This cannot be specified if afixed_date
block is specified. - rules List<Property Map>
- One or more (up to 10)
rule
blocks as defined below.
AutoscaleSettingProfileCapacity, AutoscaleSettingProfileCapacityArgs
- Default int
- 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. Valid values are between
0
and1000
. - Maximum int
The maximum number of instances for this resource. Valid values are between
0
and1000
.NOTE: The maximum number of instances is also limited by the amount of Cores available in the subscription.
- Minimum int
- The minimum number of instances for this resource. Valid values are between
0
and1000
.
- Default int
- 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. Valid values are between
0
and1000
. - Maximum int
The maximum number of instances for this resource. Valid values are between
0
and1000
.NOTE: The maximum number of instances is also limited by the amount of Cores available in the subscription.
- Minimum int
- The minimum number of instances for this resource. Valid values are between
0
and1000
.
- default_ Integer
- 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. Valid values are between
0
and1000
. - maximum Integer
The maximum number of instances for this resource. Valid values are between
0
and1000
.NOTE: The maximum number of instances is also limited by the amount of Cores available in the subscription.
- minimum Integer
- The minimum number of instances for this resource. Valid values are between
0
and1000
.
- default number
- 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. Valid values are between
0
and1000
. - maximum number
The maximum number of instances for this resource. Valid values are between
0
and1000
.NOTE: The maximum number of instances is also limited by the amount of Cores available in the subscription.
- minimum number
- The minimum number of instances for this resource. Valid values are between
0
and1000
.
- default int
- 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. Valid values are between
0
and1000
. - maximum int
The maximum number of instances for this resource. Valid values are between
0
and1000
.NOTE: The maximum number of instances is also limited by the amount of Cores available in the subscription.
- minimum int
- The minimum number of instances for this resource. Valid values are between
0
and1000
.
- default Number
- 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. Valid values are between
0
and1000
. - maximum Number
The maximum number of instances for this resource. Valid values are between
0
and1000
.NOTE: The maximum number of instances is also limited by the amount of Cores available in the subscription.
- minimum Number
- The minimum number of instances for this resource. Valid values are between
0
and1000
.
AutoscaleSettingProfileFixedDate, AutoscaleSettingProfileFixedDateArgs
- End string
- Specifies the end date for the profile, formatted as an RFC3339 date string.
- Start string
- Specifies the start date for the profile, formatted as an RFC3339 date string.
- Timezone string
- The Time Zone of the
start
andend
times. A list of possible values can be found here. Defaults toUTC
.
- End string
- Specifies the end date for the profile, formatted as an RFC3339 date string.
- Start string
- Specifies the start date for the profile, formatted as an RFC3339 date string.
- Timezone string
- The Time Zone of the
start
andend
times. A list of possible values can be found here. Defaults toUTC
.
- end String
- Specifies the end date for the profile, formatted as an RFC3339 date string.
- start String
- Specifies the start date for the profile, formatted as an RFC3339 date string.
- timezone String
- The Time Zone of the
start
andend
times. A list of possible values can be found here. Defaults toUTC
.
- end string
- Specifies the end date for the profile, formatted as an RFC3339 date string.
- start string
- Specifies the start date for the profile, formatted as an RFC3339 date string.
- timezone string
- The Time Zone of the
start
andend
times. A list of possible values can be found here. Defaults toUTC
.
- end str
- Specifies the end date for the profile, formatted as an RFC3339 date string.
- start str
- Specifies the start date for the profile, formatted as an RFC3339 date string.
- timezone str
- The Time Zone of the
start
andend
times. A list of possible values can be found here. Defaults toUTC
.
- end String
- Specifies the end date for the profile, formatted as an RFC3339 date string.
- start String
- Specifies the start date for the profile, formatted as an RFC3339 date string.
- timezone String
- The Time Zone of the
start
andend
times. A list of possible values can be found here. Defaults toUTC
.
AutoscaleSettingProfileRecurrence, AutoscaleSettingProfileRecurrenceArgs
- Days List<string>
- A list of days that this profile takes effect on. Possible values include
Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
andSunday
. - Hours int
- A list containing a single item, which specifies the Hour interval at which this recurrence should be triggered (in 24-hour time). Possible values are from
0
to23
. - Minutes int
- A list containing a single item which specifies the Minute interval at which this recurrence should be triggered.
- Timezone string
- The Time Zone used for the
hours
field. A list of possible values can be found here). Defaults toUTC
.
- Days []string
- A list of days that this profile takes effect on. Possible values include
Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
andSunday
. - Hours int
- A list containing a single item, which specifies the Hour interval at which this recurrence should be triggered (in 24-hour time). Possible values are from
0
to23
. - Minutes int
- A list containing a single item which specifies the Minute interval at which this recurrence should be triggered.
- Timezone string
- The Time Zone used for the
hours
field. A list of possible values can be found here). Defaults toUTC
.
- days List<String>
- A list of days that this profile takes effect on. Possible values include
Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
andSunday
. - hours Integer
- A list containing a single item, which specifies the Hour interval at which this recurrence should be triggered (in 24-hour time). Possible values are from
0
to23
. - minutes Integer
- A list containing a single item which specifies the Minute interval at which this recurrence should be triggered.
- timezone String
- The Time Zone used for the
hours
field. A list of possible values can be found here). Defaults toUTC
.
- days string[]
- A list of days that this profile takes effect on. Possible values include
Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
andSunday
. - hours number
- A list containing a single item, which specifies the Hour interval at which this recurrence should be triggered (in 24-hour time). Possible values are from
0
to23
. - minutes number
- A list containing a single item which specifies the Minute interval at which this recurrence should be triggered.
- timezone string
- The Time Zone used for the
hours
field. A list of possible values can be found here). Defaults toUTC
.
- days Sequence[str]
- A list of days that this profile takes effect on. Possible values include
Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
andSunday
. - hours int
- A list containing a single item, which specifies the Hour interval at which this recurrence should be triggered (in 24-hour time). Possible values are from
0
to23
. - minutes int
- A list containing a single item which specifies the Minute interval at which this recurrence should be triggered.
- timezone str
- The Time Zone used for the
hours
field. A list of possible values can be found here). Defaults toUTC
.
- days List<String>
- A list of days that this profile takes effect on. Possible values include
Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
andSunday
. - hours Number
- A list containing a single item, which specifies the Hour interval at which this recurrence should be triggered (in 24-hour time). Possible values are from
0
to23
. - minutes Number
- A list containing a single item which specifies the Minute interval at which this recurrence should be triggered.
- timezone String
- The Time Zone used for the
hours
field. A list of possible values can be found here). Defaults toUTC
.
AutoscaleSettingProfileRule, AutoscaleSettingProfileRuleArgs
- Metric
Trigger AutoscaleSetting Profile Rule Metric Trigger - A
metric_trigger
block as defined below. - Scale
Action AutoscaleSetting Profile Rule Scale Action - A
scale_action
block as defined below.
- Metric
Trigger AutoscaleSetting Profile Rule Metric Trigger - A
metric_trigger
block as defined below. - Scale
Action AutoscaleSetting Profile Rule Scale Action - A
scale_action
block as defined below.
- metric
Trigger AutoscaleSetting Profile Rule Metric Trigger - A
metric_trigger
block as defined below. - scale
Action AutoscaleSetting Profile Rule Scale Action - A
scale_action
block as defined below.
- metric
Trigger AutoscaleSetting Profile Rule Metric Trigger - A
metric_trigger
block as defined below. - scale
Action AutoscaleSetting Profile Rule Scale Action - A
scale_action
block as defined below.
- metric_
trigger AutoscaleSetting Profile Rule Metric Trigger - A
metric_trigger
block as defined below. - scale_
action AutoscaleSetting Profile Rule Scale Action - A
scale_action
block as defined below.
- metric
Trigger Property Map - A
metric_trigger
block as defined below. - scale
Action Property Map - A
scale_action
block as defined below.
AutoscaleSettingProfileRuleMetricTrigger, AutoscaleSettingProfileRuleMetricTriggerArgs
- Metric
Name string The name of the metric that defines what the rule monitors, such as
Percentage CPU
forVirtual Machine Scale Sets
andCpuPercentage
forApp Service Plan
.NOTE: The allowed value of
metric_name
highly depends on the targeting resource type, please visit Supported metrics with Azure Monitor for more details.- Metric
Resource stringId - The ID of the Resource which the Rule monitors.
- Operator string
- Specifies the operator used to compare the metric data and threshold. Possible values are:
Equals
,NotEquals
,GreaterThan
,GreaterThanOrEqual
,LessThan
,LessThanOrEqual
. - Statistic string
- Specifies how the metrics from multiple instances are combined. Possible values are
Average
,Max
,Min
andSum
. - Threshold double
- Specifies the threshold of the metric that triggers the scale action.
- Time
Aggregation string - Specifies how the data that's collected should be combined over time. Possible values include
Average
,Count
,Maximum
,Minimum
,Last
andTotal
. - Time
Grain string - Specifies the granularity of metrics that the rule monitors, which must be one of the pre-defined values returned from the metric definitions for the metric. This value must be between 1 minute and 12 hours an be formatted as an ISO 8601 string.
- Time
Window string - Specifies the time range for which data is collected, which must be greater than the delay in metric collection (which varies from resource to resource). This value must be between 5 minutes and 12 hours and be formatted as an ISO 8601 string.
- Dimensions
List<Autoscale
Setting Profile Rule Metric Trigger Dimension> - One or more
dimensions
block as defined below. - Divide
By boolInstance Count - Whether to enable metric divide by instance count.
- Metric
Namespace string - The namespace of the metric that defines what the rule monitors, such as
microsoft.compute/virtualmachinescalesets
forVirtual Machine Scale Sets
.
- Metric
Name string The name of the metric that defines what the rule monitors, such as
Percentage CPU
forVirtual Machine Scale Sets
andCpuPercentage
forApp Service Plan
.NOTE: The allowed value of
metric_name
highly depends on the targeting resource type, please visit Supported metrics with Azure Monitor for more details.- Metric
Resource stringId - The ID of the Resource which the Rule monitors.
- Operator string
- Specifies the operator used to compare the metric data and threshold. Possible values are:
Equals
,NotEquals
,GreaterThan
,GreaterThanOrEqual
,LessThan
,LessThanOrEqual
. - Statistic string
- Specifies how the metrics from multiple instances are combined. Possible values are
Average
,Max
,Min
andSum
. - Threshold float64
- Specifies the threshold of the metric that triggers the scale action.
- Time
Aggregation string - Specifies how the data that's collected should be combined over time. Possible values include
Average
,Count
,Maximum
,Minimum
,Last
andTotal
. - Time
Grain string - Specifies the granularity of metrics that the rule monitors, which must be one of the pre-defined values returned from the metric definitions for the metric. This value must be between 1 minute and 12 hours an be formatted as an ISO 8601 string.
- Time
Window string - Specifies the time range for which data is collected, which must be greater than the delay in metric collection (which varies from resource to resource). This value must be between 5 minutes and 12 hours and be formatted as an ISO 8601 string.
- Dimensions
[]Autoscale
Setting Profile Rule Metric Trigger Dimension - One or more
dimensions
block as defined below. - Divide
By boolInstance Count - Whether to enable metric divide by instance count.
- Metric
Namespace string - The namespace of the metric that defines what the rule monitors, such as
microsoft.compute/virtualmachinescalesets
forVirtual Machine Scale Sets
.
- metric
Name String The name of the metric that defines what the rule monitors, such as
Percentage CPU
forVirtual Machine Scale Sets
andCpuPercentage
forApp Service Plan
.NOTE: The allowed value of
metric_name
highly depends on the targeting resource type, please visit Supported metrics with Azure Monitor for more details.- metric
Resource StringId - The ID of the Resource which the Rule monitors.
- operator String
- Specifies the operator used to compare the metric data and threshold. Possible values are:
Equals
,NotEquals
,GreaterThan
,GreaterThanOrEqual
,LessThan
,LessThanOrEqual
. - statistic String
- Specifies how the metrics from multiple instances are combined. Possible values are
Average
,Max
,Min
andSum
. - threshold Double
- Specifies the threshold of the metric that triggers the scale action.
- time
Aggregation String - Specifies how the data that's collected should be combined over time. Possible values include
Average
,Count
,Maximum
,Minimum
,Last
andTotal
. - time
Grain String - Specifies the granularity of metrics that the rule monitors, which must be one of the pre-defined values returned from the metric definitions for the metric. This value must be between 1 minute and 12 hours an be formatted as an ISO 8601 string.
- time
Window String - Specifies the time range for which data is collected, which must be greater than the delay in metric collection (which varies from resource to resource). This value must be between 5 minutes and 12 hours and be formatted as an ISO 8601 string.
- dimensions
List<Autoscale
Setting Profile Rule Metric Trigger Dimension> - One or more
dimensions
block as defined below. - divide
By BooleanInstance Count - Whether to enable metric divide by instance count.
- metric
Namespace String - The namespace of the metric that defines what the rule monitors, such as
microsoft.compute/virtualmachinescalesets
forVirtual Machine Scale Sets
.
- metric
Name string The name of the metric that defines what the rule monitors, such as
Percentage CPU
forVirtual Machine Scale Sets
andCpuPercentage
forApp Service Plan
.NOTE: The allowed value of
metric_name
highly depends on the targeting resource type, please visit Supported metrics with Azure Monitor for more details.- metric
Resource stringId - The ID of the Resource which the Rule monitors.
- operator string
- Specifies the operator used to compare the metric data and threshold. Possible values are:
Equals
,NotEquals
,GreaterThan
,GreaterThanOrEqual
,LessThan
,LessThanOrEqual
. - statistic string
- Specifies how the metrics from multiple instances are combined. Possible values are
Average
,Max
,Min
andSum
. - threshold number
- Specifies the threshold of the metric that triggers the scale action.
- time
Aggregation string - Specifies how the data that's collected should be combined over time. Possible values include
Average
,Count
,Maximum
,Minimum
,Last
andTotal
. - time
Grain string - Specifies the granularity of metrics that the rule monitors, which must be one of the pre-defined values returned from the metric definitions for the metric. This value must be between 1 minute and 12 hours an be formatted as an ISO 8601 string.
- time
Window string - Specifies the time range for which data is collected, which must be greater than the delay in metric collection (which varies from resource to resource). This value must be between 5 minutes and 12 hours and be formatted as an ISO 8601 string.
- dimensions
Autoscale
Setting Profile Rule Metric Trigger Dimension[] - One or more
dimensions
block as defined below. - divide
By booleanInstance Count - Whether to enable metric divide by instance count.
- metric
Namespace string - The namespace of the metric that defines what the rule monitors, such as
microsoft.compute/virtualmachinescalesets
forVirtual Machine Scale Sets
.
- metric_
name str The name of the metric that defines what the rule monitors, such as
Percentage CPU
forVirtual Machine Scale Sets
andCpuPercentage
forApp Service Plan
.NOTE: The allowed value of
metric_name
highly depends on the targeting resource type, please visit Supported metrics with Azure Monitor for more details.- metric_
resource_ strid - The ID of the Resource which the Rule monitors.
- operator str
- Specifies the operator used to compare the metric data and threshold. Possible values are:
Equals
,NotEquals
,GreaterThan
,GreaterThanOrEqual
,LessThan
,LessThanOrEqual
. - statistic str
- Specifies how the metrics from multiple instances are combined. Possible values are
Average
,Max
,Min
andSum
. - threshold float
- Specifies the threshold of the metric that triggers the scale action.
- time_
aggregation str - Specifies how the data that's collected should be combined over time. Possible values include
Average
,Count
,Maximum
,Minimum
,Last
andTotal
. - time_
grain str - Specifies the granularity of metrics that the rule monitors, which must be one of the pre-defined values returned from the metric definitions for the metric. This value must be between 1 minute and 12 hours an be formatted as an ISO 8601 string.
- time_
window str - Specifies the time range for which data is collected, which must be greater than the delay in metric collection (which varies from resource to resource). This value must be between 5 minutes and 12 hours and be formatted as an ISO 8601 string.
- dimensions
Sequence[Autoscale
Setting Profile Rule Metric Trigger Dimension] - One or more
dimensions
block as defined below. - divide_
by_ boolinstance_ count - Whether to enable metric divide by instance count.
- metric_
namespace str - The namespace of the metric that defines what the rule monitors, such as
microsoft.compute/virtualmachinescalesets
forVirtual Machine Scale Sets
.
- metric
Name String The name of the metric that defines what the rule monitors, such as
Percentage CPU
forVirtual Machine Scale Sets
andCpuPercentage
forApp Service Plan
.NOTE: The allowed value of
metric_name
highly depends on the targeting resource type, please visit Supported metrics with Azure Monitor for more details.- metric
Resource StringId - The ID of the Resource which the Rule monitors.
- operator String
- Specifies the operator used to compare the metric data and threshold. Possible values are:
Equals
,NotEquals
,GreaterThan
,GreaterThanOrEqual
,LessThan
,LessThanOrEqual
. - statistic String
- Specifies how the metrics from multiple instances are combined. Possible values are
Average
,Max
,Min
andSum
. - threshold Number
- Specifies the threshold of the metric that triggers the scale action.
- time
Aggregation String - Specifies how the data that's collected should be combined over time. Possible values include
Average
,Count
,Maximum
,Minimum
,Last
andTotal
. - time
Grain String - Specifies the granularity of metrics that the rule monitors, which must be one of the pre-defined values returned from the metric definitions for the metric. This value must be between 1 minute and 12 hours an be formatted as an ISO 8601 string.
- time
Window String - Specifies the time range for which data is collected, which must be greater than the delay in metric collection (which varies from resource to resource). This value must be between 5 minutes and 12 hours and be formatted as an ISO 8601 string.
- dimensions List<Property Map>
- One or more
dimensions
block as defined below. - divide
By BooleanInstance Count - Whether to enable metric divide by instance count.
- metric
Namespace String - The namespace of the metric that defines what the rule monitors, such as
microsoft.compute/virtualmachinescalesets
forVirtual Machine Scale Sets
.
AutoscaleSettingProfileRuleMetricTriggerDimension, AutoscaleSettingProfileRuleMetricTriggerDimensionArgs
AutoscaleSettingProfileRuleScaleAction, AutoscaleSettingProfileRuleScaleActionArgs
- Cooldown string
- The amount of time to wait since the last scaling action before this action occurs. Must be between 1 minute and 1 week and formatted as a ISO 8601 string.
- Direction string
- The scale direction. Possible values are
Increase
andDecrease
. - Type string
- The type of action that should occur. Possible values are
ChangeCount
,ExactCount
,PercentChangeCount
andServiceAllowedNextValue
. - Value int
- The number of instances involved in the scaling action.
- Cooldown string
- The amount of time to wait since the last scaling action before this action occurs. Must be between 1 minute and 1 week and formatted as a ISO 8601 string.
- Direction string
- The scale direction. Possible values are
Increase
andDecrease
. - Type string
- The type of action that should occur. Possible values are
ChangeCount
,ExactCount
,PercentChangeCount
andServiceAllowedNextValue
. - Value int
- The number of instances involved in the scaling action.
- cooldown String
- The amount of time to wait since the last scaling action before this action occurs. Must be between 1 minute and 1 week and formatted as a ISO 8601 string.
- direction String
- The scale direction. Possible values are
Increase
andDecrease
. - type String
- The type of action that should occur. Possible values are
ChangeCount
,ExactCount
,PercentChangeCount
andServiceAllowedNextValue
. - value Integer
- The number of instances involved in the scaling action.
- cooldown string
- The amount of time to wait since the last scaling action before this action occurs. Must be between 1 minute and 1 week and formatted as a ISO 8601 string.
- direction string
- The scale direction. Possible values are
Increase
andDecrease
. - type string
- The type of action that should occur. Possible values are
ChangeCount
,ExactCount
,PercentChangeCount
andServiceAllowedNextValue
. - value number
- The number of instances involved in the scaling action.
- cooldown str
- The amount of time to wait since the last scaling action before this action occurs. Must be between 1 minute and 1 week and formatted as a ISO 8601 string.
- direction str
- The scale direction. Possible values are
Increase
andDecrease
. - type str
- The type of action that should occur. Possible values are
ChangeCount
,ExactCount
,PercentChangeCount
andServiceAllowedNextValue
. - value int
- The number of instances involved in the scaling action.
- cooldown String
- The amount of time to wait since the last scaling action before this action occurs. Must be between 1 minute and 1 week and formatted as a ISO 8601 string.
- direction String
- The scale direction. Possible values are
Increase
andDecrease
. - type String
- The type of action that should occur. Possible values are
ChangeCount
,ExactCount
,PercentChangeCount
andServiceAllowedNextValue
. - value Number
- The number of instances involved in the scaling action.
Import
AutoScale Setting can be imported using the resource id
, e.g.
$ pulumi import azure:monitoring/autoscaleSetting:AutoscaleSetting example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Insights/autoScaleSettings/setting1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurerm
Terraform Provider.