1. Packages
  2. Azure Classic
  3. API Docs
  4. monitoring
  5. MetricAlert

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.monitoring.MetricAlert

Explore with Pulumi AI

Manages a Metric Alert within Azure Monitor.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const toMonitor = new azure.storage.Account("to_monitor", {
    name: "examplestorageaccount",
    resourceGroupName: example.name,
    location: example.location,
    accountTier: "Standard",
    accountReplicationType: "LRS",
});
const main = new azure.monitoring.ActionGroup("main", {
    name: "example-actiongroup",
    resourceGroupName: example.name,
    shortName: "exampleact",
    webhookReceivers: [{
        name: "callmyapi",
        serviceUri: "http://example.com/alert",
    }],
});
const exampleMetricAlert = new azure.monitoring.MetricAlert("example", {
    name: "example-metricalert",
    resourceGroupName: example.name,
    scopes: [toMonitor.id],
    description: "Action will be triggered when Transactions count is greater than 50.",
    criterias: [{
        metricNamespace: "Microsoft.Storage/storageAccounts",
        metricName: "Transactions",
        aggregation: "Total",
        operator: "GreaterThan",
        threshold: 50,
        dimensions: [{
            name: "ApiName",
            operator: "Include",
            values: ["*"],
        }],
    }],
    actions: [{
        actionGroupId: main.id,
    }],
});
Copy
import pulumi
import pulumi_azure as azure

example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
to_monitor = azure.storage.Account("to_monitor",
    name="examplestorageaccount",
    resource_group_name=example.name,
    location=example.location,
    account_tier="Standard",
    account_replication_type="LRS")
main = azure.monitoring.ActionGroup("main",
    name="example-actiongroup",
    resource_group_name=example.name,
    short_name="exampleact",
    webhook_receivers=[{
        "name": "callmyapi",
        "service_uri": "http://example.com/alert",
    }])
example_metric_alert = azure.monitoring.MetricAlert("example",
    name="example-metricalert",
    resource_group_name=example.name,
    scopes=[to_monitor.id],
    description="Action will be triggered when Transactions count is greater than 50.",
    criterias=[{
        "metric_namespace": "Microsoft.Storage/storageAccounts",
        "metric_name": "Transactions",
        "aggregation": "Total",
        "operator": "GreaterThan",
        "threshold": 50,
        "dimensions": [{
            "name": "ApiName",
            "operator": "Include",
            "values": ["*"],
        }],
    }],
    actions=[{
        "action_group_id": main.id,
    }])
Copy
package main

import (
	"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/storage"
	"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("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		toMonitor, err := storage.NewAccount(ctx, "to_monitor", &storage.AccountArgs{
			Name:                   pulumi.String("examplestorageaccount"),
			ResourceGroupName:      example.Name,
			Location:               example.Location,
			AccountTier:            pulumi.String("Standard"),
			AccountReplicationType: pulumi.String("LRS"),
		})
		if err != nil {
			return err
		}
		main, err := monitoring.NewActionGroup(ctx, "main", &monitoring.ActionGroupArgs{
			Name:              pulumi.String("example-actiongroup"),
			ResourceGroupName: example.Name,
			ShortName:         pulumi.String("exampleact"),
			WebhookReceivers: monitoring.ActionGroupWebhookReceiverArray{
				&monitoring.ActionGroupWebhookReceiverArgs{
					Name:       pulumi.String("callmyapi"),
					ServiceUri: pulumi.String("http://example.com/alert"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = monitoring.NewMetricAlert(ctx, "example", &monitoring.MetricAlertArgs{
			Name:              pulumi.String("example-metricalert"),
			ResourceGroupName: example.Name,
			Scopes: pulumi.StringArray{
				toMonitor.ID(),
			},
			Description: pulumi.String("Action will be triggered when Transactions count is greater than 50."),
			Criterias: monitoring.MetricAlertCriteriaArray{
				&monitoring.MetricAlertCriteriaArgs{
					MetricNamespace: pulumi.String("Microsoft.Storage/storageAccounts"),
					MetricName:      pulumi.String("Transactions"),
					Aggregation:     pulumi.String("Total"),
					Operator:        pulumi.String("GreaterThan"),
					Threshold:       pulumi.Float64(50),
					Dimensions: monitoring.MetricAlertCriteriaDimensionArray{
						&monitoring.MetricAlertCriteriaDimensionArgs{
							Name:     pulumi.String("ApiName"),
							Operator: pulumi.String("Include"),
							Values: pulumi.StringArray{
								pulumi.String("*"),
							},
						},
					},
				},
			},
			Actions: monitoring.MetricAlertActionArray{
				&monitoring.MetricAlertActionArgs{
					ActionGroupId: main.ID(),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 = "example-resources",
        Location = "West Europe",
    });

    var toMonitor = new Azure.Storage.Account("to_monitor", new()
    {
        Name = "examplestorageaccount",
        ResourceGroupName = example.Name,
        Location = example.Location,
        AccountTier = "Standard",
        AccountReplicationType = "LRS",
    });

    var main = new Azure.Monitoring.ActionGroup("main", new()
    {
        Name = "example-actiongroup",
        ResourceGroupName = example.Name,
        ShortName = "exampleact",
        WebhookReceivers = new[]
        {
            new Azure.Monitoring.Inputs.ActionGroupWebhookReceiverArgs
            {
                Name = "callmyapi",
                ServiceUri = "http://example.com/alert",
            },
        },
    });

    var exampleMetricAlert = new Azure.Monitoring.MetricAlert("example", new()
    {
        Name = "example-metricalert",
        ResourceGroupName = example.Name,
        Scopes = new[]
        {
            toMonitor.Id,
        },
        Description = "Action will be triggered when Transactions count is greater than 50.",
        Criterias = new[]
        {
            new Azure.Monitoring.Inputs.MetricAlertCriteriaArgs
            {
                MetricNamespace = "Microsoft.Storage/storageAccounts",
                MetricName = "Transactions",
                Aggregation = "Total",
                Operator = "GreaterThan",
                Threshold = 50,
                Dimensions = new[]
                {
                    new Azure.Monitoring.Inputs.MetricAlertCriteriaDimensionArgs
                    {
                        Name = "ApiName",
                        Operator = "Include",
                        Values = new[]
                        {
                            "*",
                        },
                    },
                },
            },
        },
        Actions = new[]
        {
            new Azure.Monitoring.Inputs.MetricAlertActionArgs
            {
                ActionGroupId = main.Id,
            },
        },
    });

});
Copy
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.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.monitoring.ActionGroup;
import com.pulumi.azure.monitoring.ActionGroupArgs;
import com.pulumi.azure.monitoring.inputs.ActionGroupWebhookReceiverArgs;
import com.pulumi.azure.monitoring.MetricAlert;
import com.pulumi.azure.monitoring.MetricAlertArgs;
import com.pulumi.azure.monitoring.inputs.MetricAlertCriteriaArgs;
import com.pulumi.azure.monitoring.inputs.MetricAlertActionArgs;
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("example-resources")
            .location("West Europe")
            .build());

        var toMonitor = new Account("toMonitor", AccountArgs.builder()
            .name("examplestorageaccount")
            .resourceGroupName(example.name())
            .location(example.location())
            .accountTier("Standard")
            .accountReplicationType("LRS")
            .build());

        var main = new ActionGroup("main", ActionGroupArgs.builder()
            .name("example-actiongroup")
            .resourceGroupName(example.name())
            .shortName("exampleact")
            .webhookReceivers(ActionGroupWebhookReceiverArgs.builder()
                .name("callmyapi")
                .serviceUri("http://example.com/alert")
                .build())
            .build());

        var exampleMetricAlert = new MetricAlert("exampleMetricAlert", MetricAlertArgs.builder()
            .name("example-metricalert")
            .resourceGroupName(example.name())
            .scopes(toMonitor.id())
            .description("Action will be triggered when Transactions count is greater than 50.")
            .criterias(MetricAlertCriteriaArgs.builder()
                .metricNamespace("Microsoft.Storage/storageAccounts")
                .metricName("Transactions")
                .aggregation("Total")
                .operator("GreaterThan")
                .threshold(50)
                .dimensions(MetricAlertCriteriaDimensionArgs.builder()
                    .name("ApiName")
                    .operator("Include")
                    .values("*")
                    .build())
                .build())
            .actions(MetricAlertActionArgs.builder()
                .actionGroupId(main.id())
                .build())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  toMonitor:
    type: azure:storage:Account
    name: to_monitor
    properties:
      name: examplestorageaccount
      resourceGroupName: ${example.name}
      location: ${example.location}
      accountTier: Standard
      accountReplicationType: LRS
  main:
    type: azure:monitoring:ActionGroup
    properties:
      name: example-actiongroup
      resourceGroupName: ${example.name}
      shortName: exampleact
      webhookReceivers:
        - name: callmyapi
          serviceUri: http://example.com/alert
  exampleMetricAlert:
    type: azure:monitoring:MetricAlert
    name: example
    properties:
      name: example-metricalert
      resourceGroupName: ${example.name}
      scopes:
        - ${toMonitor.id}
      description: Action will be triggered when Transactions count is greater than 50.
      criterias:
        - metricNamespace: Microsoft.Storage/storageAccounts
          metricName: Transactions
          aggregation: Total
          operator: GreaterThan
          threshold: 50
          dimensions:
            - name: ApiName
              operator: Include
              values:
                - '*'
      actions:
        - actionGroupId: ${main.id}
Copy

Create MetricAlert Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new MetricAlert(name: string, args: MetricAlertArgs, opts?: CustomResourceOptions);
@overload
def MetricAlert(resource_name: str,
                args: MetricAlertArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def MetricAlert(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                resource_group_name: Optional[str] = None,
                scopes: Optional[Sequence[str]] = None,
                name: Optional[str] = None,
                auto_mitigate: Optional[bool] = None,
                description: Optional[str] = None,
                dynamic_criteria: Optional[MetricAlertDynamicCriteriaArgs] = None,
                enabled: Optional[bool] = None,
                frequency: Optional[str] = None,
                actions: Optional[Sequence[MetricAlertActionArgs]] = None,
                criterias: Optional[Sequence[MetricAlertCriteriaArgs]] = None,
                application_insights_web_test_location_availability_criteria: Optional[MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs] = None,
                severity: Optional[int] = None,
                tags: Optional[Mapping[str, str]] = None,
                target_resource_location: Optional[str] = None,
                target_resource_type: Optional[str] = None,
                window_size: Optional[str] = None)
func NewMetricAlert(ctx *Context, name string, args MetricAlertArgs, opts ...ResourceOption) (*MetricAlert, error)
public MetricAlert(string name, MetricAlertArgs args, CustomResourceOptions? opts = null)
public MetricAlert(String name, MetricAlertArgs args)
public MetricAlert(String name, MetricAlertArgs args, CustomResourceOptions options)
type: azure:monitoring:MetricAlert
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. MetricAlertArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. MetricAlertArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. MetricAlertArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. MetricAlertArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. MetricAlertArgs
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 metricAlertResource = new Azure.Monitoring.MetricAlert("metricAlertResource", new()
{
    ResourceGroupName = "string",
    Scopes = new[]
    {
        "string",
    },
    Name = "string",
    AutoMitigate = false,
    Description = "string",
    DynamicCriteria = new Azure.Monitoring.Inputs.MetricAlertDynamicCriteriaArgs
    {
        Aggregation = "string",
        AlertSensitivity = "string",
        MetricName = "string",
        MetricNamespace = "string",
        Operator = "string",
        Dimensions = new[]
        {
            new Azure.Monitoring.Inputs.MetricAlertDynamicCriteriaDimensionArgs
            {
                Name = "string",
                Operator = "string",
                Values = new[]
                {
                    "string",
                },
            },
        },
        EvaluationFailureCount = 0,
        EvaluationTotalCount = 0,
        IgnoreDataBefore = "string",
        SkipMetricValidation = false,
    },
    Enabled = false,
    Frequency = "string",
    Actions = new[]
    {
        new Azure.Monitoring.Inputs.MetricAlertActionArgs
        {
            ActionGroupId = "string",
            WebhookProperties = 
            {
                { "string", "string" },
            },
        },
    },
    Criterias = new[]
    {
        new Azure.Monitoring.Inputs.MetricAlertCriteriaArgs
        {
            Aggregation = "string",
            MetricName = "string",
            MetricNamespace = "string",
            Operator = "string",
            Threshold = 0,
            Dimensions = new[]
            {
                new Azure.Monitoring.Inputs.MetricAlertCriteriaDimensionArgs
                {
                    Name = "string",
                    Operator = "string",
                    Values = new[]
                    {
                        "string",
                    },
                },
            },
            SkipMetricValidation = false,
        },
    },
    ApplicationInsightsWebTestLocationAvailabilityCriteria = new Azure.Monitoring.Inputs.MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs
    {
        ComponentId = "string",
        FailedLocationCount = 0,
        WebTestId = "string",
    },
    Severity = 0,
    Tags = 
    {
        { "string", "string" },
    },
    TargetResourceLocation = "string",
    TargetResourceType = "string",
    WindowSize = "string",
});
Copy
example, err := monitoring.NewMetricAlert(ctx, "metricAlertResource", &monitoring.MetricAlertArgs{
	ResourceGroupName: pulumi.String("string"),
	Scopes: pulumi.StringArray{
		pulumi.String("string"),
	},
	Name:         pulumi.String("string"),
	AutoMitigate: pulumi.Bool(false),
	Description:  pulumi.String("string"),
	DynamicCriteria: &monitoring.MetricAlertDynamicCriteriaArgs{
		Aggregation:      pulumi.String("string"),
		AlertSensitivity: pulumi.String("string"),
		MetricName:       pulumi.String("string"),
		MetricNamespace:  pulumi.String("string"),
		Operator:         pulumi.String("string"),
		Dimensions: monitoring.MetricAlertDynamicCriteriaDimensionArray{
			&monitoring.MetricAlertDynamicCriteriaDimensionArgs{
				Name:     pulumi.String("string"),
				Operator: pulumi.String("string"),
				Values: pulumi.StringArray{
					pulumi.String("string"),
				},
			},
		},
		EvaluationFailureCount: pulumi.Int(0),
		EvaluationTotalCount:   pulumi.Int(0),
		IgnoreDataBefore:       pulumi.String("string"),
		SkipMetricValidation:   pulumi.Bool(false),
	},
	Enabled:   pulumi.Bool(false),
	Frequency: pulumi.String("string"),
	Actions: monitoring.MetricAlertActionArray{
		&monitoring.MetricAlertActionArgs{
			ActionGroupId: pulumi.String("string"),
			WebhookProperties: pulumi.StringMap{
				"string": pulumi.String("string"),
			},
		},
	},
	Criterias: monitoring.MetricAlertCriteriaArray{
		&monitoring.MetricAlertCriteriaArgs{
			Aggregation:     pulumi.String("string"),
			MetricName:      pulumi.String("string"),
			MetricNamespace: pulumi.String("string"),
			Operator:        pulumi.String("string"),
			Threshold:       pulumi.Float64(0),
			Dimensions: monitoring.MetricAlertCriteriaDimensionArray{
				&monitoring.MetricAlertCriteriaDimensionArgs{
					Name:     pulumi.String("string"),
					Operator: pulumi.String("string"),
					Values: pulumi.StringArray{
						pulumi.String("string"),
					},
				},
			},
			SkipMetricValidation: pulumi.Bool(false),
		},
	},
	ApplicationInsightsWebTestLocationAvailabilityCriteria: &monitoring.MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs{
		ComponentId:         pulumi.String("string"),
		FailedLocationCount: pulumi.Int(0),
		WebTestId:           pulumi.String("string"),
	},
	Severity: pulumi.Int(0),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	TargetResourceLocation: pulumi.String("string"),
	TargetResourceType:     pulumi.String("string"),
	WindowSize:             pulumi.String("string"),
})
Copy
var metricAlertResource = new MetricAlert("metricAlertResource", MetricAlertArgs.builder()
    .resourceGroupName("string")
    .scopes("string")
    .name("string")
    .autoMitigate(false)
    .description("string")
    .dynamicCriteria(MetricAlertDynamicCriteriaArgs.builder()
        .aggregation("string")
        .alertSensitivity("string")
        .metricName("string")
        .metricNamespace("string")
        .operator("string")
        .dimensions(MetricAlertDynamicCriteriaDimensionArgs.builder()
            .name("string")
            .operator("string")
            .values("string")
            .build())
        .evaluationFailureCount(0)
        .evaluationTotalCount(0)
        .ignoreDataBefore("string")
        .skipMetricValidation(false)
        .build())
    .enabled(false)
    .frequency("string")
    .actions(MetricAlertActionArgs.builder()
        .actionGroupId("string")
        .webhookProperties(Map.of("string", "string"))
        .build())
    .criterias(MetricAlertCriteriaArgs.builder()
        .aggregation("string")
        .metricName("string")
        .metricNamespace("string")
        .operator("string")
        .threshold(0)
        .dimensions(MetricAlertCriteriaDimensionArgs.builder()
            .name("string")
            .operator("string")
            .values("string")
            .build())
        .skipMetricValidation(false)
        .build())
    .applicationInsightsWebTestLocationAvailabilityCriteria(MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs.builder()
        .componentId("string")
        .failedLocationCount(0)
        .webTestId("string")
        .build())
    .severity(0)
    .tags(Map.of("string", "string"))
    .targetResourceLocation("string")
    .targetResourceType("string")
    .windowSize("string")
    .build());
Copy
metric_alert_resource = azure.monitoring.MetricAlert("metricAlertResource",
    resource_group_name="string",
    scopes=["string"],
    name="string",
    auto_mitigate=False,
    description="string",
    dynamic_criteria={
        "aggregation": "string",
        "alert_sensitivity": "string",
        "metric_name": "string",
        "metric_namespace": "string",
        "operator": "string",
        "dimensions": [{
            "name": "string",
            "operator": "string",
            "values": ["string"],
        }],
        "evaluation_failure_count": 0,
        "evaluation_total_count": 0,
        "ignore_data_before": "string",
        "skip_metric_validation": False,
    },
    enabled=False,
    frequency="string",
    actions=[{
        "action_group_id": "string",
        "webhook_properties": {
            "string": "string",
        },
    }],
    criterias=[{
        "aggregation": "string",
        "metric_name": "string",
        "metric_namespace": "string",
        "operator": "string",
        "threshold": 0,
        "dimensions": [{
            "name": "string",
            "operator": "string",
            "values": ["string"],
        }],
        "skip_metric_validation": False,
    }],
    application_insights_web_test_location_availability_criteria={
        "component_id": "string",
        "failed_location_count": 0,
        "web_test_id": "string",
    },
    severity=0,
    tags={
        "string": "string",
    },
    target_resource_location="string",
    target_resource_type="string",
    window_size="string")
Copy
const metricAlertResource = new azure.monitoring.MetricAlert("metricAlertResource", {
    resourceGroupName: "string",
    scopes: ["string"],
    name: "string",
    autoMitigate: false,
    description: "string",
    dynamicCriteria: {
        aggregation: "string",
        alertSensitivity: "string",
        metricName: "string",
        metricNamespace: "string",
        operator: "string",
        dimensions: [{
            name: "string",
            operator: "string",
            values: ["string"],
        }],
        evaluationFailureCount: 0,
        evaluationTotalCount: 0,
        ignoreDataBefore: "string",
        skipMetricValidation: false,
    },
    enabled: false,
    frequency: "string",
    actions: [{
        actionGroupId: "string",
        webhookProperties: {
            string: "string",
        },
    }],
    criterias: [{
        aggregation: "string",
        metricName: "string",
        metricNamespace: "string",
        operator: "string",
        threshold: 0,
        dimensions: [{
            name: "string",
            operator: "string",
            values: ["string"],
        }],
        skipMetricValidation: false,
    }],
    applicationInsightsWebTestLocationAvailabilityCriteria: {
        componentId: "string",
        failedLocationCount: 0,
        webTestId: "string",
    },
    severity: 0,
    tags: {
        string: "string",
    },
    targetResourceLocation: "string",
    targetResourceType: "string",
    windowSize: "string",
});
Copy
type: azure:monitoring:MetricAlert
properties:
    actions:
        - actionGroupId: string
          webhookProperties:
            string: string
    applicationInsightsWebTestLocationAvailabilityCriteria:
        componentId: string
        failedLocationCount: 0
        webTestId: string
    autoMitigate: false
    criterias:
        - aggregation: string
          dimensions:
            - name: string
              operator: string
              values:
                - string
          metricName: string
          metricNamespace: string
          operator: string
          skipMetricValidation: false
          threshold: 0
    description: string
    dynamicCriteria:
        aggregation: string
        alertSensitivity: string
        dimensions:
            - name: string
              operator: string
              values:
                - string
        evaluationFailureCount: 0
        evaluationTotalCount: 0
        ignoreDataBefore: string
        metricName: string
        metricNamespace: string
        operator: string
        skipMetricValidation: false
    enabled: false
    frequency: string
    name: string
    resourceGroupName: string
    scopes:
        - string
    severity: 0
    tags:
        string: string
    targetResourceLocation: string
    targetResourceType: string
    windowSize: string
Copy

MetricAlert 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 MetricAlert resource accepts the following input properties:

ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
Scopes This property is required. List<string>
A set of strings of resource IDs at which the metric criteria should be applied.
Actions List<MetricAlertAction>
One or more action blocks as defined below.
ApplicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteria

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

AutoMitigate bool
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
Criterias List<MetricAlertCriteria>

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Description string
The description of this Metric Alert.
DynamicCriteria MetricAlertDynamicCriteria

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Enabled bool
Should this Metric Alert be enabled? Defaults to true.
Frequency string
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
Name Changes to this property will trigger replacement. string
The name of the Metric Alert. Changing this forces a new resource to be created.
Severity int
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
Tags Dictionary<string, string>
A mapping of tags to assign to the resource.
TargetResourceLocation string

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

TargetResourceType string

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

WindowSize string
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
Scopes This property is required. []string
A set of strings of resource IDs at which the metric criteria should be applied.
Actions []MetricAlertActionArgs
One or more action blocks as defined below.
ApplicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

AutoMitigate bool
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
Criterias []MetricAlertCriteriaArgs

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Description string
The description of this Metric Alert.
DynamicCriteria MetricAlertDynamicCriteriaArgs

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Enabled bool
Should this Metric Alert be enabled? Defaults to true.
Frequency string
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
Name Changes to this property will trigger replacement. string
The name of the Metric Alert. Changing this forces a new resource to be created.
Severity int
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
Tags map[string]string
A mapping of tags to assign to the resource.
TargetResourceLocation string

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

TargetResourceType string

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

WindowSize string
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes This property is required. List<String>
A set of strings of resource IDs at which the metric criteria should be applied.
actions List<MetricAlertAction>
One or more action blocks as defined below.
applicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteria

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

autoMitigate Boolean
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias List<MetricAlertCriteria>

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description String
The description of this Metric Alert.
dynamicCriteria MetricAlertDynamicCriteria

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled Boolean
Should this Metric Alert be enabled? Defaults to true.
frequency String
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. String
The name of the Metric Alert. Changing this forces a new resource to be created.
severity Integer
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags Map<String,String>
A mapping of tags to assign to the resource.
targetResourceLocation String

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

targetResourceType String

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

windowSize String
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes This property is required. string[]
A set of strings of resource IDs at which the metric criteria should be applied.
actions MetricAlertAction[]
One or more action blocks as defined below.
applicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteria

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

autoMitigate boolean
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias MetricAlertCriteria[]

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description string
The description of this Metric Alert.
dynamicCriteria MetricAlertDynamicCriteria

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled boolean
Should this Metric Alert be enabled? Defaults to true.
frequency string
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. string
The name of the Metric Alert. Changing this forces a new resource to be created.
severity number
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags {[key: string]: string}
A mapping of tags to assign to the resource.
targetResourceLocation string

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

targetResourceType string

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

windowSize string
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes This property is required. Sequence[str]
A set of strings of resource IDs at which the metric criteria should be applied.
actions Sequence[MetricAlertActionArgs]
One or more action blocks as defined below.
application_insights_web_test_location_availability_criteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

auto_mitigate bool
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias Sequence[MetricAlertCriteriaArgs]

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description str
The description of this Metric Alert.
dynamic_criteria MetricAlertDynamicCriteriaArgs

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled bool
Should this Metric Alert be enabled? Defaults to true.
frequency str
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. str
The name of the Metric Alert. Changing this forces a new resource to be created.
severity int
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags Mapping[str, str]
A mapping of tags to assign to the resource.
target_resource_location str

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

target_resource_type str

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

window_size str
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes This property is required. List<String>
A set of strings of resource IDs at which the metric criteria should be applied.
actions List<Property Map>
One or more action blocks as defined below.
applicationInsightsWebTestLocationAvailabilityCriteria Property Map

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

autoMitigate Boolean
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias List<Property Map>

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description String
The description of this Metric Alert.
dynamicCriteria Property Map

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled Boolean
Should this Metric Alert be enabled? Defaults to true.
frequency String
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. String
The name of the Metric Alert. Changing this forces a new resource to be created.
severity Number
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags Map<String>
A mapping of tags to assign to the resource.
targetResourceLocation String

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

targetResourceType String

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

windowSize String
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.

Outputs

All input properties are implicitly available as output properties. Additionally, the MetricAlert 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 MetricAlert Resource

Get an existing MetricAlert 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?: MetricAlertState, opts?: CustomResourceOptions): MetricAlert
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        actions: Optional[Sequence[MetricAlertActionArgs]] = None,
        application_insights_web_test_location_availability_criteria: Optional[MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs] = None,
        auto_mitigate: Optional[bool] = None,
        criterias: Optional[Sequence[MetricAlertCriteriaArgs]] = None,
        description: Optional[str] = None,
        dynamic_criteria: Optional[MetricAlertDynamicCriteriaArgs] = None,
        enabled: Optional[bool] = None,
        frequency: Optional[str] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        scopes: Optional[Sequence[str]] = None,
        severity: Optional[int] = None,
        tags: Optional[Mapping[str, str]] = None,
        target_resource_location: Optional[str] = None,
        target_resource_type: Optional[str] = None,
        window_size: Optional[str] = None) -> MetricAlert
func GetMetricAlert(ctx *Context, name string, id IDInput, state *MetricAlertState, opts ...ResourceOption) (*MetricAlert, error)
public static MetricAlert Get(string name, Input<string> id, MetricAlertState? state, CustomResourceOptions? opts = null)
public static MetricAlert get(String name, Output<String> id, MetricAlertState state, CustomResourceOptions options)
resources:  _:    type: azure:monitoring:MetricAlert    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
Actions List<MetricAlertAction>
One or more action blocks as defined below.
ApplicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteria

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

AutoMitigate bool
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
Criterias List<MetricAlertCriteria>

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Description string
The description of this Metric Alert.
DynamicCriteria MetricAlertDynamicCriteria

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Enabled bool
Should this Metric Alert be enabled? Defaults to true.
Frequency string
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
Name Changes to this property will trigger replacement. string
The name of the Metric Alert. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
Scopes List<string>
A set of strings of resource IDs at which the metric criteria should be applied.
Severity int
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
Tags Dictionary<string, string>
A mapping of tags to assign to the resource.
TargetResourceLocation string

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

TargetResourceType string

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

WindowSize string
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
Actions []MetricAlertActionArgs
One or more action blocks as defined below.
ApplicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

AutoMitigate bool
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
Criterias []MetricAlertCriteriaArgs

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Description string
The description of this Metric Alert.
DynamicCriteria MetricAlertDynamicCriteriaArgs

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

Enabled bool
Should this Metric Alert be enabled? Defaults to true.
Frequency string
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
Name Changes to this property will trigger replacement. string
The name of the Metric Alert. Changing this forces a new resource to be created.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
Scopes []string
A set of strings of resource IDs at which the metric criteria should be applied.
Severity int
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
Tags map[string]string
A mapping of tags to assign to the resource.
TargetResourceLocation string

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

TargetResourceType string

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

WindowSize string
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
actions List<MetricAlertAction>
One or more action blocks as defined below.
applicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteria

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

autoMitigate Boolean
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias List<MetricAlertCriteria>

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description String
The description of this Metric Alert.
dynamicCriteria MetricAlertDynamicCriteria

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled Boolean
Should this Metric Alert be enabled? Defaults to true.
frequency String
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. String
The name of the Metric Alert. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes List<String>
A set of strings of resource IDs at which the metric criteria should be applied.
severity Integer
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags Map<String,String>
A mapping of tags to assign to the resource.
targetResourceLocation String

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

targetResourceType String

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

windowSize String
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
actions MetricAlertAction[]
One or more action blocks as defined below.
applicationInsightsWebTestLocationAvailabilityCriteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteria

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

autoMitigate boolean
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias MetricAlertCriteria[]

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description string
The description of this Metric Alert.
dynamicCriteria MetricAlertDynamicCriteria

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled boolean
Should this Metric Alert be enabled? Defaults to true.
frequency string
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. string
The name of the Metric Alert. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. string
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes string[]
A set of strings of resource IDs at which the metric criteria should be applied.
severity number
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags {[key: string]: string}
A mapping of tags to assign to the resource.
targetResourceLocation string

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

targetResourceType string

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

windowSize string
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
actions Sequence[MetricAlertActionArgs]
One or more action blocks as defined below.
application_insights_web_test_location_availability_criteria MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

auto_mitigate bool
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias Sequence[MetricAlertCriteriaArgs]

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description str
The description of this Metric Alert.
dynamic_criteria MetricAlertDynamicCriteriaArgs

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled bool
Should this Metric Alert be enabled? Defaults to true.
frequency str
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. str
The name of the Metric Alert. Changing this forces a new resource to be created.
resource_group_name Changes to this property will trigger replacement. str
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes Sequence[str]
A set of strings of resource IDs at which the metric criteria should be applied.
severity int
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags Mapping[str, str]
A mapping of tags to assign to the resource.
target_resource_location str

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

target_resource_type str

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

window_size str
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.
actions List<Property Map>
One or more action blocks as defined below.
applicationInsightsWebTestLocationAvailabilityCriteria Property Map

A application_insights_web_test_location_availability_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

autoMitigate Boolean
Should the alerts in this Metric Alert be auto resolved? Defaults to true.
criterias List<Property Map>

One or more (static) criteria blocks as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

description String
The description of this Metric Alert.
dynamicCriteria Property Map

A dynamic_criteria block as defined below.

NOTE One of either criteria, dynamic_criteria or application_insights_web_test_location_availability_criteria must be specified.

enabled Boolean
Should this Metric Alert be enabled? Defaults to true.
frequency String
The evaluation frequency of this Metric Alert, represented in ISO 8601 duration format. Possible values are PT1M, PT5M, PT15M, PT30M and PT1H. Defaults to PT1M.
name Changes to this property will trigger replacement. String
The name of the Metric Alert. Changing this forces a new resource to be created.
resourceGroupName Changes to this property will trigger replacement. String
The name of the resource group in which to create the Metric Alert instance. Changing this forces a new resource to be created.
scopes List<String>
A set of strings of resource IDs at which the metric criteria should be applied.
severity Number
The severity of this Metric Alert. Possible values are 0, 1, 2, 3 and 4. Defaults to 3.
tags Map<String>
A mapping of tags to assign to the resource.
targetResourceLocation String

The location of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

targetResourceType String

The resource type (e.g. Microsoft.Compute/virtualMachines) of the target resource.

This is Required when using a Subscription as scope, a Resource Group as scope or Multiple Scopes.

windowSize String
The period of time that is used to monitor alert activity, represented in ISO 8601 duration format. This value must be greater than frequency. Possible values are PT1M, PT5M, PT15M, PT30M, PT1H, PT6H, PT12H and P1D. Defaults to PT5M.

Supporting Types

MetricAlertAction
, MetricAlertActionArgs

ActionGroupId This property is required. string
The ID of the Action Group can be sourced from the azure.monitoring.ActionGroup resource
WebhookProperties Dictionary<string, string>
The map of custom string properties to include with the post operation. These data are appended to the webhook payload.
ActionGroupId This property is required. string
The ID of the Action Group can be sourced from the azure.monitoring.ActionGroup resource
WebhookProperties map[string]string
The map of custom string properties to include with the post operation. These data are appended to the webhook payload.
actionGroupId This property is required. String
The ID of the Action Group can be sourced from the azure.monitoring.ActionGroup resource
webhookProperties Map<String,String>
The map of custom string properties to include with the post operation. These data are appended to the webhook payload.
actionGroupId This property is required. string
The ID of the Action Group can be sourced from the azure.monitoring.ActionGroup resource
webhookProperties {[key: string]: string}
The map of custom string properties to include with the post operation. These data are appended to the webhook payload.
action_group_id This property is required. str
The ID of the Action Group can be sourced from the azure.monitoring.ActionGroup resource
webhook_properties Mapping[str, str]
The map of custom string properties to include with the post operation. These data are appended to the webhook payload.
actionGroupId This property is required. String
The ID of the Action Group can be sourced from the azure.monitoring.ActionGroup resource
webhookProperties Map<String>
The map of custom string properties to include with the post operation. These data are appended to the webhook payload.

MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteria
, MetricAlertApplicationInsightsWebTestLocationAvailabilityCriteriaArgs

ComponentId This property is required. string
The ID of the Application Insights Resource.
FailedLocationCount This property is required. int
The number of failed locations.
WebTestId This property is required. string
The ID of the Application Insights Web Test.
ComponentId This property is required. string
The ID of the Application Insights Resource.
FailedLocationCount This property is required. int
The number of failed locations.
WebTestId This property is required. string
The ID of the Application Insights Web Test.
componentId This property is required. String
The ID of the Application Insights Resource.
failedLocationCount This property is required. Integer
The number of failed locations.
webTestId This property is required. String
The ID of the Application Insights Web Test.
componentId This property is required. string
The ID of the Application Insights Resource.
failedLocationCount This property is required. number
The number of failed locations.
webTestId This property is required. string
The ID of the Application Insights Web Test.
component_id This property is required. str
The ID of the Application Insights Resource.
failed_location_count This property is required. int
The number of failed locations.
web_test_id This property is required. str
The ID of the Application Insights Web Test.
componentId This property is required. String
The ID of the Application Insights Resource.
failedLocationCount This property is required. Number
The number of failed locations.
webTestId This property is required. String
The ID of the Application Insights Web Test.

MetricAlertCriteria
, MetricAlertCriteriaArgs

Aggregation This property is required. string
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
MetricName This property is required. string
One of the metric names to be monitored.
MetricNamespace This property is required. string
One of the metric namespaces to be monitored.
Operator This property is required. string
The criteria operator. Possible values are Equals, GreaterThan, GreaterThanOrEqual, LessThan and LessThanOrEqual.
Threshold This property is required. double
The criteria threshold value that activates the alert.
Dimensions List<MetricAlertCriteriaDimension>
One or more dimension blocks as defined below.
SkipMetricValidation bool
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted? Defaults to false.
Aggregation This property is required. string
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
MetricName This property is required. string
One of the metric names to be monitored.
MetricNamespace This property is required. string
One of the metric namespaces to be monitored.
Operator This property is required. string
The criteria operator. Possible values are Equals, GreaterThan, GreaterThanOrEqual, LessThan and LessThanOrEqual.
Threshold This property is required. float64
The criteria threshold value that activates the alert.
Dimensions []MetricAlertCriteriaDimension
One or more dimension blocks as defined below.
SkipMetricValidation bool
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted? Defaults to false.
aggregation This property is required. String
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
metricName This property is required. String
One of the metric names to be monitored.
metricNamespace This property is required. String
One of the metric namespaces to be monitored.
operator This property is required. String
The criteria operator. Possible values are Equals, GreaterThan, GreaterThanOrEqual, LessThan and LessThanOrEqual.
threshold This property is required. Double
The criteria threshold value that activates the alert.
dimensions List<MetricAlertCriteriaDimension>
One or more dimension blocks as defined below.
skipMetricValidation Boolean
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted? Defaults to false.
aggregation This property is required. string
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
metricName This property is required. string
One of the metric names to be monitored.
metricNamespace This property is required. string
One of the metric namespaces to be monitored.
operator This property is required. string
The criteria operator. Possible values are Equals, GreaterThan, GreaterThanOrEqual, LessThan and LessThanOrEqual.
threshold This property is required. number
The criteria threshold value that activates the alert.
dimensions MetricAlertCriteriaDimension[]
One or more dimension blocks as defined below.
skipMetricValidation boolean
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted? Defaults to false.
aggregation This property is required. str
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
metric_name This property is required. str
One of the metric names to be monitored.
metric_namespace This property is required. str
One of the metric namespaces to be monitored.
operator This property is required. str
The criteria operator. Possible values are Equals, GreaterThan, GreaterThanOrEqual, LessThan and LessThanOrEqual.
threshold This property is required. float
The criteria threshold value that activates the alert.
dimensions Sequence[MetricAlertCriteriaDimension]
One or more dimension blocks as defined below.
skip_metric_validation bool
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted? Defaults to false.
aggregation This property is required. String
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
metricName This property is required. String
One of the metric names to be monitored.
metricNamespace This property is required. String
One of the metric namespaces to be monitored.
operator This property is required. String
The criteria operator. Possible values are Equals, GreaterThan, GreaterThanOrEqual, LessThan and LessThanOrEqual.
threshold This property is required. Number
The criteria threshold value that activates the alert.
dimensions List<Property Map>
One or more dimension blocks as defined below.
skipMetricValidation Boolean
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted? Defaults to false.

MetricAlertCriteriaDimension
, MetricAlertCriteriaDimensionArgs

Name This property is required. string
One of the dimension names.
Operator This property is required. string
The dimension operator. Possible values are Include, Exclude and StartsWith.
Values This property is required. List<string>
The list of dimension values.
Name This property is required. string
One of the dimension names.
Operator This property is required. string
The dimension operator. Possible values are Include, Exclude and StartsWith.
Values This property is required. []string
The list of dimension values.
name This property is required. String
One of the dimension names.
operator This property is required. String
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. List<String>
The list of dimension values.
name This property is required. string
One of the dimension names.
operator This property is required. string
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. string[]
The list of dimension values.
name This property is required. str
One of the dimension names.
operator This property is required. str
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. Sequence[str]
The list of dimension values.
name This property is required. String
One of the dimension names.
operator This property is required. String
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. List<String>
The list of dimension values.

MetricAlertDynamicCriteria
, MetricAlertDynamicCriteriaArgs

Aggregation This property is required. string
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
AlertSensitivity This property is required. string
The extent of deviation required to trigger an alert. Possible values are Low, Medium and High.
MetricName This property is required. string
One of the metric names to be monitored.
MetricNamespace This property is required. string
One of the metric namespaces to be monitored.
Operator This property is required. string
The criteria operator. Possible values are LessThan, GreaterThan and GreaterOrLessThan.
Dimensions List<MetricAlertDynamicCriteriaDimension>
One or more dimension blocks as defined below.
EvaluationFailureCount int
The number of violations to trigger an alert. Should be smaller or equal to evaluation_total_count. Defaults to 4.
EvaluationTotalCount int
The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (window_size) and the selected number of aggregated points. Defaults to 4.
IgnoreDataBefore string
The ISO8601 date from which to start learning the metric historical data and calculate the dynamic thresholds.
SkipMetricValidation bool
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted?
Aggregation This property is required. string
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
AlertSensitivity This property is required. string
The extent of deviation required to trigger an alert. Possible values are Low, Medium and High.
MetricName This property is required. string
One of the metric names to be monitored.
MetricNamespace This property is required. string
One of the metric namespaces to be monitored.
Operator This property is required. string
The criteria operator. Possible values are LessThan, GreaterThan and GreaterOrLessThan.
Dimensions []MetricAlertDynamicCriteriaDimension
One or more dimension blocks as defined below.
EvaluationFailureCount int
The number of violations to trigger an alert. Should be smaller or equal to evaluation_total_count. Defaults to 4.
EvaluationTotalCount int
The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (window_size) and the selected number of aggregated points. Defaults to 4.
IgnoreDataBefore string
The ISO8601 date from which to start learning the metric historical data and calculate the dynamic thresholds.
SkipMetricValidation bool
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted?
aggregation This property is required. String
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
alertSensitivity This property is required. String
The extent of deviation required to trigger an alert. Possible values are Low, Medium and High.
metricName This property is required. String
One of the metric names to be monitored.
metricNamespace This property is required. String
One of the metric namespaces to be monitored.
operator This property is required. String
The criteria operator. Possible values are LessThan, GreaterThan and GreaterOrLessThan.
dimensions List<MetricAlertDynamicCriteriaDimension>
One or more dimension blocks as defined below.
evaluationFailureCount Integer
The number of violations to trigger an alert. Should be smaller or equal to evaluation_total_count. Defaults to 4.
evaluationTotalCount Integer
The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (window_size) and the selected number of aggregated points. Defaults to 4.
ignoreDataBefore String
The ISO8601 date from which to start learning the metric historical data and calculate the dynamic thresholds.
skipMetricValidation Boolean
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted?
aggregation This property is required. string
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
alertSensitivity This property is required. string
The extent of deviation required to trigger an alert. Possible values are Low, Medium and High.
metricName This property is required. string
One of the metric names to be monitored.
metricNamespace This property is required. string
One of the metric namespaces to be monitored.
operator This property is required. string
The criteria operator. Possible values are LessThan, GreaterThan and GreaterOrLessThan.
dimensions MetricAlertDynamicCriteriaDimension[]
One or more dimension blocks as defined below.
evaluationFailureCount number
The number of violations to trigger an alert. Should be smaller or equal to evaluation_total_count. Defaults to 4.
evaluationTotalCount number
The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (window_size) and the selected number of aggregated points. Defaults to 4.
ignoreDataBefore string
The ISO8601 date from which to start learning the metric historical data and calculate the dynamic thresholds.
skipMetricValidation boolean
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted?
aggregation This property is required. str
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
alert_sensitivity This property is required. str
The extent of deviation required to trigger an alert. Possible values are Low, Medium and High.
metric_name This property is required. str
One of the metric names to be monitored.
metric_namespace This property is required. str
One of the metric namespaces to be monitored.
operator This property is required. str
The criteria operator. Possible values are LessThan, GreaterThan and GreaterOrLessThan.
dimensions Sequence[MetricAlertDynamicCriteriaDimension]
One or more dimension blocks as defined below.
evaluation_failure_count int
The number of violations to trigger an alert. Should be smaller or equal to evaluation_total_count. Defaults to 4.
evaluation_total_count int
The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (window_size) and the selected number of aggregated points. Defaults to 4.
ignore_data_before str
The ISO8601 date from which to start learning the metric historical data and calculate the dynamic thresholds.
skip_metric_validation bool
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted?
aggregation This property is required. String
The statistic that runs over the metric values. Possible values are Average, Count, Minimum, Maximum and Total.
alertSensitivity This property is required. String
The extent of deviation required to trigger an alert. Possible values are Low, Medium and High.
metricName This property is required. String
One of the metric names to be monitored.
metricNamespace This property is required. String
One of the metric namespaces to be monitored.
operator This property is required. String
The criteria operator. Possible values are LessThan, GreaterThan and GreaterOrLessThan.
dimensions List<Property Map>
One or more dimension blocks as defined below.
evaluationFailureCount Number
The number of violations to trigger an alert. Should be smaller or equal to evaluation_total_count. Defaults to 4.
evaluationTotalCount Number
The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (window_size) and the selected number of aggregated points. Defaults to 4.
ignoreDataBefore String
The ISO8601 date from which to start learning the metric historical data and calculate the dynamic thresholds.
skipMetricValidation Boolean
Skip the metric validation to allow creating an alert rule on a custom metric that isn't yet emitted?

MetricAlertDynamicCriteriaDimension
, MetricAlertDynamicCriteriaDimensionArgs

Name This property is required. string
One of the dimension names.
Operator This property is required. string
The dimension operator. Possible values are Include, Exclude and StartsWith.
Values This property is required. List<string>
The list of dimension values.
Name This property is required. string
One of the dimension names.
Operator This property is required. string
The dimension operator. Possible values are Include, Exclude and StartsWith.
Values This property is required. []string
The list of dimension values.
name This property is required. String
One of the dimension names.
operator This property is required. String
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. List<String>
The list of dimension values.
name This property is required. string
One of the dimension names.
operator This property is required. string
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. string[]
The list of dimension values.
name This property is required. str
One of the dimension names.
operator This property is required. str
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. Sequence[str]
The list of dimension values.
name This property is required. String
One of the dimension names.
operator This property is required. String
The dimension operator. Possible values are Include, Exclude and StartsWith.
values This property is required. List<String>
The list of dimension values.

Import

Metric Alerts can be imported using the resource id, e.g.

$ pulumi import azure:monitoring/metricAlert:MetricAlert main /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.Insights/metricAlerts/example-metricalert
Copy

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.