Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Azure Native

v1.42.0 published on Monday, Oct 25, 2021 by Pulumi

ScheduledQueryRule

The Log Search Rule resource. API Version: 2018-04-16.

Example Usage

Create or Update rule - AlertingAction

using Pulumi;
using AzureNative = Pulumi.AzureNative;

class MyStack : Stack
{
    public MyStack()
    {
        var scheduledQueryRule = new AzureNative.Insights.ScheduledQueryRule("scheduledQueryRule", new AzureNative.Insights.ScheduledQueryRuleArgs
        {
            Action = new AzureNative.Insights.Inputs.AlertingActionArgs
            {
                AznsAction = new AzureNative.Insights.Inputs.AzNsActionGroupArgs
                {
                    ActionGroup = {},
                    CustomWebhookPayload = "{}",
                    EmailSubject = "Email Header",
                },
                OdataType = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
                Severity = "1",
                Trigger = new AzureNative.Insights.Inputs.TriggerConditionArgs
                {
                    MetricTrigger = new AzureNative.Insights.Inputs.LogMetricTriggerArgs
                    {
                        MetricColumn = "Computer",
                        MetricTriggerType = "Consecutive",
                        Threshold = 5,
                        ThresholdOperator = "GreaterThan",
                    },
                    Threshold = 3,
                    ThresholdOperator = "GreaterThan",
                },
            },
            Description = "log alert description",
            Enabled = "true",
            Location = "eastus",
            ResourceGroupName = "Rac46PostSwapRG",
            RuleName = "logalertfoo",
            Schedule = new AzureNative.Insights.Inputs.ScheduleArgs
            {
                FrequencyInMinutes = 15,
                TimeWindowInMinutes = 15,
            },
            Source = new AzureNative.Insights.Inputs.SourceArgs
            {
                DataSourceId = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace",
                Query = "Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)",
                QueryType = "ResultCount",
            },
            Tags = ,
        });
    }

}

package main

import (
	insights "github.com/pulumi/pulumi-azure-native/sdk/go/azure/insights"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := insights.NewScheduledQueryRule(ctx, "scheduledQueryRule", &insights.ScheduledQueryRuleArgs{
			Action: insights.AlertingAction{
				AznsAction: insights.AzNsActionGroup{
					ActionGroup:          []interface{}{},
					CustomWebhookPayload: "{}",
					EmailSubject:         "Email Header",
				},
				OdataType: "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
				Severity:  "1",
				Trigger: insights.TriggerCondition{
					MetricTrigger: insights.LogMetricTrigger{
						MetricColumn:      "Computer",
						MetricTriggerType: "Consecutive",
						Threshold:         5,
						ThresholdOperator: "GreaterThan",
					},
					Threshold:         3,
					ThresholdOperator: "GreaterThan",
				},
			},
			Description:       pulumi.String("log alert description"),
			Enabled:           pulumi.String("true"),
			Location:          pulumi.String("eastus"),
			ResourceGroupName: pulumi.String("Rac46PostSwapRG"),
			RuleName:          pulumi.String("logalertfoo"),
			Schedule: &insights.ScheduleArgs{
				FrequencyInMinutes:  pulumi.Int(15),
				TimeWindowInMinutes: pulumi.Int(15),
			},
			Source: &insights.SourceArgs{
				DataSourceId: pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace"),
				Query:        pulumi.String("Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)"),
				QueryType:    pulumi.String("ResultCount"),
			},
			Tags: nil,
		})
		if err != nil {
			return err
		}
		return nil
	})
}

import pulumi
import pulumi_azure_native as azure_native

scheduled_query_rule = azure_native.insights.ScheduledQueryRule("scheduledQueryRule",
    action=azure_native.insights.AlertingActionArgs(
        azns_action=azure_native.insights.AzNsActionGroupArgs(
            action_group=[],
            custom_webhook_payload="{}",
            email_subject="Email Header",
        ),
        odata_type="Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
        severity="1",
        trigger=azure_native.insights.TriggerConditionArgs(
            metric_trigger=azure_native.insights.LogMetricTriggerArgs(
                metric_column="Computer",
                metric_trigger_type="Consecutive",
                threshold=5,
                threshold_operator="GreaterThan",
            ),
            threshold=3,
            threshold_operator="GreaterThan",
        ),
    ),
    description="log alert description",
    enabled="true",
    location="eastus",
    resource_group_name="Rac46PostSwapRG",
    rule_name="logalertfoo",
    schedule=azure_native.insights.ScheduleArgs(
        frequency_in_minutes=15,
        time_window_in_minutes=15,
    ),
    source=azure_native.insights.SourceArgs(
        data_source_id="/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace",
        query="Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)",
        query_type="ResultCount",
    ),
    tags={})

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const scheduledQueryRule = new azure_native.insights.ScheduledQueryRule("scheduledQueryRule", {
    action: {
        aznsAction: {
            actionGroup: [],
            customWebhookPayload: "{}",
            emailSubject: "Email Header",
        },
        odataType: "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
        severity: "1",
        trigger: {
            metricTrigger: {
                metricColumn: "Computer",
                metricTriggerType: "Consecutive",
                threshold: 5,
                thresholdOperator: "GreaterThan",
            },
            threshold: 3,
            thresholdOperator: "GreaterThan",
        },
    },
    description: "log alert description",
    enabled: "true",
    location: "eastus",
    resourceGroupName: "Rac46PostSwapRG",
    ruleName: "logalertfoo",
    schedule: {
        frequencyInMinutes: 15,
        timeWindowInMinutes: 15,
    },
    source: {
        dataSourceId: "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace",
        query: "Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)",
        queryType: "ResultCount",
    },
    tags: {},
});

Create or Update rule - AlertingAction with Cross-Resource

using Pulumi;
using AzureNative = Pulumi.AzureNative;

class MyStack : Stack
{
    public MyStack()
    {
        var scheduledQueryRule = new AzureNative.Insights.ScheduledQueryRule("scheduledQueryRule", new AzureNative.Insights.ScheduledQueryRuleArgs
        {
            Action = new AzureNative.Insights.Inputs.AlertingActionArgs
            {
                AznsAction = new AzureNative.Insights.Inputs.AzNsActionGroupArgs
                {
                    ActionGroup = 
                    {
                        "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/actiongroups/test-ag",
                    },
                    EmailSubject = "Cross Resource Mail!!",
                },
                OdataType = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
                Severity = "3",
                Trigger = new AzureNative.Insights.Inputs.TriggerConditionArgs
                {
                    Threshold = 5000,
                    ThresholdOperator = "GreaterThan",
                },
            },
            Description = "Sample Cross Resource alert",
            Enabled = "true",
            Location = "eastus",
            ResourceGroupName = "Rac46PostSwapRG",
            RuleName = "SampleCrossResourceAlert",
            Schedule = new AzureNative.Insights.Inputs.ScheduleArgs
            {
                FrequencyInMinutes = 60,
                TimeWindowInMinutes = 60,
            },
            Source = new AzureNative.Insights.Inputs.SourceArgs
            {
                AuthorizedResources = 
                {
                    "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace",
                    "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
                },
                DataSourceId = "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
                Query = "union requests, workspace(\"sampleWorkspace\").Update",
                QueryType = "ResultCount",
            },
            Tags = ,
        });
    }

}

package main

import (
	insights "github.com/pulumi/pulumi-azure-native/sdk/go/azure/insights"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := insights.NewScheduledQueryRule(ctx, "scheduledQueryRule", &insights.ScheduledQueryRuleArgs{
			Action: insights.AlertingAction{
				AznsAction: insights.AzNsActionGroup{
					ActionGroup: []string{
						"/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/actiongroups/test-ag",
					},
					EmailSubject: "Cross Resource Mail!!",
				},
				OdataType: "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
				Severity:  "3",
				Trigger: insights.TriggerCondition{
					Threshold:         5000,
					ThresholdOperator: "GreaterThan",
				},
			},
			Description:       pulumi.String("Sample Cross Resource alert"),
			Enabled:           pulumi.String("true"),
			Location:          pulumi.String("eastus"),
			ResourceGroupName: pulumi.String("Rac46PostSwapRG"),
			RuleName:          pulumi.String("SampleCrossResourceAlert"),
			Schedule: &insights.ScheduleArgs{
				FrequencyInMinutes:  pulumi.Int(60),
				TimeWindowInMinutes: pulumi.Int(60),
			},
			Source: &insights.SourceArgs{
				AuthorizedResources: pulumi.StringArray{
					pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace"),
					pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI"),
				},
				DataSourceId: pulumi.String("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI"),
				Query:        pulumi.String("union requests, workspace(\"sampleWorkspace\").Update"),
				QueryType:    pulumi.String("ResultCount"),
			},
			Tags: nil,
		})
		if err != nil {
			return err
		}
		return nil
	})
}

import pulumi
import pulumi_azure_native as azure_native

scheduled_query_rule = azure_native.insights.ScheduledQueryRule("scheduledQueryRule",
    action=azure_native.insights.AlertingActionArgs(
        azns_action=azure_native.insights.AzNsActionGroupArgs(
            action_group=["/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/actiongroups/test-ag"],
            email_subject="Cross Resource Mail!!",
        ),
        odata_type="Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
        severity="3",
        trigger=azure_native.insights.TriggerConditionArgs(
            threshold=5000,
            threshold_operator="GreaterThan",
        ),
    ),
    description="Sample Cross Resource alert",
    enabled="true",
    location="eastus",
    resource_group_name="Rac46PostSwapRG",
    rule_name="SampleCrossResourceAlert",
    schedule=azure_native.insights.ScheduleArgs(
        frequency_in_minutes=60,
        time_window_in_minutes=60,
    ),
    source=azure_native.insights.SourceArgs(
        authorized_resources=[
            "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace",
            "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
        ],
        data_source_id="/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
        query="union requests, workspace(\"sampleWorkspace\").Update",
        query_type="ResultCount",
    ),
    tags={})

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const scheduledQueryRule = new azure_native.insights.ScheduledQueryRule("scheduledQueryRule", {
    action: {
        aznsAction: {
            actionGroup: ["/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/actiongroups/test-ag"],
            emailSubject: "Cross Resource Mail!!",
        },
        odataType: "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction",
        severity: "3",
        trigger: {
            threshold: 5000,
            thresholdOperator: "GreaterThan",
        },
    },
    description: "Sample Cross Resource alert",
    enabled: "true",
    location: "eastus",
    resourceGroupName: "Rac46PostSwapRG",
    ruleName: "SampleCrossResourceAlert",
    schedule: {
        frequencyInMinutes: 60,
        timeWindowInMinutes: 60,
    },
    source: {
        authorizedResources: [
            "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace",
            "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
        ],
        dataSourceId: "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI",
        query: "union requests, workspace(\"sampleWorkspace\").Update",
        queryType: "ResultCount",
    },
    tags: {},
});

Create or Update rule - LogToMetricAction

using Pulumi;
using AzureNative = Pulumi.AzureNative;

class MyStack : Stack
{
    public MyStack()
    {
        var scheduledQueryRule = new AzureNative.Insights.ScheduledQueryRule("scheduledQueryRule", new AzureNative.Insights.ScheduledQueryRuleArgs
        {
            Action = new AzureNative.Insights.Inputs.LogToMetricActionArgs
            {
                Criteria = 
                {
                    new AzureNative.Insights.Inputs.CriteriaArgs
                    {
                        Dimensions = {},
                        MetricName = "Average_% Idle Time",
                    },
                },
                OdataType = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction",
            },
            Description = "log to metric description",
            Enabled = "true",
            Location = "West Europe",
            ResourceGroupName = "alertsweu",
            RuleName = "logtometricfoo",
            Source = new AzureNative.Insights.Inputs.SourceArgs
            {
                DataSourceId = "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu",
            },
            Tags = ,
        });
    }

}

package main

import (
	"fmt"

	insights "github.com/pulumi/pulumi-azure-native/sdk/go/azure/insights"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := insights.NewScheduledQueryRule(ctx, "scheduledQueryRule", &insights.ScheduledQueryRuleArgs{
			Action: insights.LogToMetricAction{
				Criteria: []insights.Criteria{
					insights.Criteria{
						Dimensions: []insights.Dimension{},
						MetricName: fmt.Sprintf("%v%v%v", "Average_", "%", " Idle Time"),
					},
				},
				OdataType: "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction",
			},
			Description:       pulumi.String("log to metric description"),
			Enabled:           pulumi.String("true"),
			Location:          pulumi.String("West Europe"),
			ResourceGroupName: pulumi.String("alertsweu"),
			RuleName:          pulumi.String("logtometricfoo"),
			Source: &insights.SourceArgs{
				DataSourceId: pulumi.String("/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu"),
			},
			Tags: nil,
		})
		if err != nil {
			return err
		}
		return nil
	})
}

import pulumi
import pulumi_azure_native as azure_native

scheduled_query_rule = azure_native.insights.ScheduledQueryRule("scheduledQueryRule",
    action=azure_native.insights.LogToMetricActionArgs(
        criteria=[azure_native.insights.CriteriaArgs(
            dimensions=[],
            metric_name="Average_% Idle Time",
        )],
        odata_type="Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction",
    ),
    description="log to metric description",
    enabled="true",
    location="West Europe",
    resource_group_name="alertsweu",
    rule_name="logtometricfoo",
    source=azure_native.insights.SourceArgs(
        data_source_id="/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu",
    ),
    tags={})

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const scheduledQueryRule = new azure_native.insights.ScheduledQueryRule("scheduledQueryRule", {
    action: {
        criteria: [{
            dimensions: [],
            metricName: `Average_% Idle Time`,
        }],
        odataType: "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction",
    },
    description: "log to metric description",
    enabled: "true",
    location: "West Europe",
    resourceGroupName: "alertsweu",
    ruleName: "logtometricfoo",
    source: {
        dataSourceId: "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu",
    },
    tags: {},
});

Create a ScheduledQueryRule Resource

new ScheduledQueryRule(name: string, args: ScheduledQueryRuleArgs, opts?: CustomResourceOptions);
@overload
def ScheduledQueryRule(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       action: Optional[Union[AlertingActionArgs, LogToMetricActionArgs]] = None,
                       auto_mitigate: Optional[bool] = None,
                       description: Optional[str] = None,
                       display_name: Optional[str] = None,
                       enabled: Optional[Union[str, Enabled]] = None,
                       location: Optional[str] = None,
                       resource_group_name: Optional[str] = None,
                       rule_name: Optional[str] = None,
                       schedule: Optional[ScheduleArgs] = None,
                       source: Optional[SourceArgs] = None,
                       tags: Optional[Mapping[str, str]] = None)
@overload
def ScheduledQueryRule(resource_name: str,
                       args: ScheduledQueryRuleArgs,
                       opts: Optional[ResourceOptions] = None)
func NewScheduledQueryRule(ctx *Context, name string, args ScheduledQueryRuleArgs, opts ...ResourceOption) (*ScheduledQueryRule, error)
public ScheduledQueryRule(string name, ScheduledQueryRuleArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ScheduledQueryRuleArgs
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 ScheduledQueryRuleArgs
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 ScheduledQueryRuleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ScheduledQueryRuleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

ScheduledQueryRule Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ScheduledQueryRule resource accepts the following input properties:

Action Pulumi.AzureNative.Insights.Inputs.AlertingActionArgs | Pulumi.AzureNative.Insights.Inputs.LogToMetricActionArgs
Action needs to be taken on rule execution.
ResourceGroupName string
The name of the resource group.
Source Pulumi.AzureNative.Insights.Inputs.SourceArgs
Data Source against which rule will Query Data
AutoMitigate bool
The flag that indicates whether the alert should be automatically resolved or not. The default is false.
Description string
The description of the Log Search rule.
DisplayName string
The display name of the alert rule
Enabled string | Pulumi.AzureNative.Insights.Enabled
The flag which indicates whether the Log Search rule is enabled. Value should be true or false
Location string
Resource location
RuleName string
The name of the rule.
Schedule Pulumi.AzureNative.Insights.Inputs.ScheduleArgs
Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction
Tags Dictionary<string, string>
Resource tags
Action AlertingActionArgs | LogToMetricActionArgs
Action needs to be taken on rule execution.
ResourceGroupName string
The name of the resource group.
Source SourceArgs
Data Source against which rule will Query Data
AutoMitigate bool
The flag that indicates whether the alert should be automatically resolved or not. The default is false.
Description string
The description of the Log Search rule.
DisplayName string
The display name of the alert rule
Enabled string | Enabled
The flag which indicates whether the Log Search rule is enabled. Value should be true or false
Location string
Resource location
RuleName string
The name of the rule.
Schedule ScheduleArgs
Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction
Tags map[string]string
Resource tags
action AlertingActionArgs | LogToMetricActionArgs
Action needs to be taken on rule execution.
resourceGroupName string
The name of the resource group.
source SourceArgs
Data Source against which rule will Query Data
autoMitigate boolean
The flag that indicates whether the alert should be automatically resolved or not. The default is false.
description string
The description of the Log Search rule.
displayName string
The display name of the alert rule
enabled string | Enabled
The flag which indicates whether the Log Search rule is enabled. Value should be true or false
location string
Resource location
ruleName string
The name of the rule.
schedule ScheduleArgs
Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction
tags {[key: string]: string}
Resource tags
action AlertingActionArgs | LogToMetricActionArgs
Action needs to be taken on rule execution.
resource_group_name str
The name of the resource group.
source SourceArgs
Data Source against which rule will Query Data
auto_mitigate bool
The flag that indicates whether the alert should be automatically resolved or not. The default is false.
description str
The description of the Log Search rule.
display_name str
The display name of the alert rule
enabled str | Enabled
The flag which indicates whether the Log Search rule is enabled. Value should be true or false
location str
Resource location
rule_name str
The name of the rule.
schedule ScheduleArgs
Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction
tags Mapping[str, str]
Resource tags

Outputs

All input properties are implicitly available as output properties. Additionally, the ScheduledQueryRule resource produces the following output properties:

CreatedWithApiVersion string
The api-version used when creating this alert rule
Etag string
The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
Id string
The provider-assigned unique ID for this managed resource.
IsLegacyLogAnalyticsRule bool
True if alert rule is legacy Log Analytic rule
Kind string
Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.
LastUpdatedTime string
Last time the rule was updated in IS08601 format.
Name string
Azure resource name
ProvisioningState string
Provisioning state of the scheduled query rule
Type string
Azure resource type
CreatedWithApiVersion string
The api-version used when creating this alert rule
Etag string
The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
Id string
The provider-assigned unique ID for this managed resource.
IsLegacyLogAnalyticsRule bool
True if alert rule is legacy Log Analytic rule
Kind string
Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.
LastUpdatedTime string
Last time the rule was updated in IS08601 format.
Name string
Azure resource name
ProvisioningState string
Provisioning state of the scheduled query rule
Type string
Azure resource type
createdWithApiVersion string
The api-version used when creating this alert rule
etag string
The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
id string
The provider-assigned unique ID for this managed resource.
isLegacyLogAnalyticsRule boolean
True if alert rule is legacy Log Analytic rule
kind string
Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.
lastUpdatedTime string
Last time the rule was updated in IS08601 format.
name string
Azure resource name
provisioningState string
Provisioning state of the scheduled query rule
type string
Azure resource type
created_with_api_version str
The api-version used when creating this alert rule
etag str
The etag field is not required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.
id str
The provider-assigned unique ID for this managed resource.
is_legacy_log_analytics_rule bool
True if alert rule is legacy Log Analytic rule
kind str
Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value.
last_updated_time str
Last time the rule was updated in IS08601 format.
name str
Azure resource name
provisioning_state str
Provisioning state of the scheduled query rule
type str
Azure resource type

Supporting Types

AlertSeverity

Zero
0
One
1
Two
2
Three
3
Four
4
AlertSeverityZero
0
AlertSeverityOne
1
AlertSeverityTwo
2
AlertSeverityThree
3
AlertSeverityFour
4
Zero
0
One
1
Two
2
Three
3
Four
4
ZERO
0
ONE
1
TWO
2
THREE
3
FOUR
4

AlertingAction

Severity string | Pulumi.AzureNative.Insights.AlertSeverity
Severity of the alert
Trigger Pulumi.AzureNative.Insights.Inputs.TriggerCondition
The trigger condition that results in the alert rule being.
AznsAction Pulumi.AzureNative.Insights.Inputs.AzNsActionGroup
Azure action group reference.
ThrottlingInMin int
time (in minutes) for which Alerts should be throttled or suppressed.
Severity string | AlertSeverity
Severity of the alert
Trigger TriggerCondition
The trigger condition that results in the alert rule being.
AznsAction AzNsActionGroup
Azure action group reference.
ThrottlingInMin int
time (in minutes) for which Alerts should be throttled or suppressed.
severity string | AlertSeverity
Severity of the alert
trigger TriggerCondition
The trigger condition that results in the alert rule being.
aznsAction AzNsActionGroup
Azure action group reference.
throttlingInMin number
time (in minutes) for which Alerts should be throttled or suppressed.
severity str | AlertSeverity
Severity of the alert
trigger TriggerCondition
The trigger condition that results in the alert rule being.
azns_action AzNsActionGroup
Azure action group reference.
throttling_in_min int
time (in minutes) for which Alerts should be throttled or suppressed.

AlertingActionResponse

Severity string
Severity of the alert
Trigger Pulumi.AzureNative.Insights.Inputs.TriggerConditionResponse
The trigger condition that results in the alert rule being.
AznsAction Pulumi.AzureNative.Insights.Inputs.AzNsActionGroupResponse
Azure action group reference.
ThrottlingInMin int
time (in minutes) for which Alerts should be throttled or suppressed.
Severity string
Severity of the alert
Trigger TriggerConditionResponse
The trigger condition that results in the alert rule being.
AznsAction AzNsActionGroupResponse
Azure action group reference.
ThrottlingInMin int
time (in minutes) for which Alerts should be throttled or suppressed.
severity string
Severity of the alert
trigger TriggerConditionResponse
The trigger condition that results in the alert rule being.
aznsAction AzNsActionGroupResponse
Azure action group reference.
throttlingInMin number
time (in minutes) for which Alerts should be throttled or suppressed.
severity str
Severity of the alert
trigger TriggerConditionResponse
The trigger condition that results in the alert rule being.
azns_action AzNsActionGroupResponse
Azure action group reference.
throttling_in_min int
time (in minutes) for which Alerts should be throttled or suppressed.

AzNsActionGroup

ActionGroup List<string>
Azure Action Group reference.
CustomWebhookPayload string
Custom payload to be sent for all webhook URI in Azure action group
EmailSubject string
Custom subject override for all email ids in Azure action group
ActionGroup []string
Azure Action Group reference.
CustomWebhookPayload string
Custom payload to be sent for all webhook URI in Azure action group
EmailSubject string
Custom subject override for all email ids in Azure action group
actionGroup string[]
Azure Action Group reference.
customWebhookPayload string
Custom payload to be sent for all webhook URI in Azure action group
emailSubject string
Custom subject override for all email ids in Azure action group
action_group Sequence[str]
Azure Action Group reference.
custom_webhook_payload str
Custom payload to be sent for all webhook URI in Azure action group
email_subject str
Custom subject override for all email ids in Azure action group

AzNsActionGroupResponse

ActionGroup List<string>
Azure Action Group reference.
CustomWebhookPayload string
Custom payload to be sent for all webhook URI in Azure action group
EmailSubject string
Custom subject override for all email ids in Azure action group
ActionGroup []string
Azure Action Group reference.
CustomWebhookPayload string
Custom payload to be sent for all webhook URI in Azure action group
EmailSubject string
Custom subject override for all email ids in Azure action group
actionGroup string[]
Azure Action Group reference.
customWebhookPayload string
Custom payload to be sent for all webhook URI in Azure action group
emailSubject string
Custom subject override for all email ids in Azure action group
action_group Sequence[str]
Azure Action Group reference.
custom_webhook_payload str
Custom payload to be sent for all webhook URI in Azure action group
email_subject str
Custom subject override for all email ids in Azure action group

ConditionalOperator

GreaterThanOrEqual
GreaterThanOrEqual
LessThanOrEqual
LessThanOrEqual
GreaterThan
GreaterThan
LessThan
LessThan
Equal
Equal
ConditionalOperatorGreaterThanOrEqual
GreaterThanOrEqual
ConditionalOperatorLessThanOrEqual
LessThanOrEqual
ConditionalOperatorGreaterThan
GreaterThan
ConditionalOperatorLessThan
LessThan
ConditionalOperatorEqual
Equal
GreaterThanOrEqual
GreaterThanOrEqual
LessThanOrEqual
LessThanOrEqual
GreaterThan
GreaterThan
LessThan
LessThan
Equal
Equal
GREATER_THAN_OR_EQUAL
GreaterThanOrEqual
LESS_THAN_OR_EQUAL
LessThanOrEqual
GREATER_THAN
GreaterThan
LESS_THAN
LessThan
EQUAL
Equal

Criteria

MetricName string
Name of the metric
Dimensions List<Pulumi.AzureNative.Insights.Inputs.Dimension>
List of Dimensions for creating metric
MetricName string
Name of the metric
Dimensions []Dimension
List of Dimensions for creating metric
metricName string
Name of the metric
dimensions Dimension[]
List of Dimensions for creating metric
metric_name str
Name of the metric
dimensions Sequence[Dimension]
List of Dimensions for creating metric

CriteriaResponse

MetricName string
Name of the metric
Dimensions List<Pulumi.AzureNative.Insights.Inputs.DimensionResponse>
List of Dimensions for creating metric
MetricName string
Name of the metric
Dimensions []DimensionResponse
List of Dimensions for creating metric
metricName string
Name of the metric
dimensions DimensionResponse[]
List of Dimensions for creating metric
metric_name str
Name of the metric
dimensions Sequence[DimensionResponse]
List of Dimensions for creating metric

Dimension

Name string
Name of the dimension
Operator string | Pulumi.AzureNative.Insights.Operator
Operator for dimension values
Values List<string>
List of dimension values
Name string
Name of the dimension
Operator string | Operator
Operator for dimension values
Values []string
List of dimension values
name string
Name of the dimension
operator string | Operator
Operator for dimension values
values string[]
List of dimension values
name str
Name of the dimension
operator str | Operator
Operator for dimension values
values Sequence[str]
List of dimension values

DimensionResponse

Name string
Name of the dimension
Operator string
Operator for dimension values
Values List<string>
List of dimension values
Name string
Name of the dimension
Operator string
Operator for dimension values
Values []string
List of dimension values
name string
Name of the dimension
operator string
Operator for dimension values
values string[]
List of dimension values
name str
Name of the dimension
operator str
Operator for dimension values
values Sequence[str]
List of dimension values

Enabled

@True
true
@False
false
EnabledTrue
true
EnabledFalse
false
True
true
False
false
TRUE
true
FALSE
false

LogMetricTrigger

MetricColumn string
Evaluation of metric on a particular column
MetricTriggerType string | Pulumi.AzureNative.Insights.MetricTriggerType
Metric Trigger Type - ‘Consecutive’ or ‘Total’
Threshold double
The threshold of the metric trigger.
ThresholdOperator string | Pulumi.AzureNative.Insights.ConditionalOperator
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.
MetricColumn string
Evaluation of metric on a particular column
MetricTriggerType string | MetricTriggerType
Metric Trigger Type - ‘Consecutive’ or ‘Total’
Threshold float64
The threshold of the metric trigger.
ThresholdOperator string | ConditionalOperator
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.
metricColumn string
Evaluation of metric on a particular column
metricTriggerType string | MetricTriggerType
Metric Trigger Type - ‘Consecutive’ or ‘Total’
threshold number
The threshold of the metric trigger.
thresholdOperator string | ConditionalOperator
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.
metric_column str
Evaluation of metric on a particular column
metric_trigger_type str | MetricTriggerType
Metric Trigger Type - ‘Consecutive’ or ‘Total’
threshold float
The threshold of the metric trigger.
threshold_operator str | ConditionalOperator
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.

LogMetricTriggerResponse

MetricColumn string
Evaluation of metric on a particular column
MetricTriggerType string
Metric Trigger Type - ‘Consecutive’ or ‘Total’
Threshold double
The threshold of the metric trigger.
ThresholdOperator string
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.
MetricColumn string
Evaluation of metric on a particular column
MetricTriggerType string
Metric Trigger Type - ‘Consecutive’ or ‘Total’
Threshold float64
The threshold of the metric trigger.
ThresholdOperator string
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.
metricColumn string
Evaluation of metric on a particular column
metricTriggerType string
Metric Trigger Type - ‘Consecutive’ or ‘Total’
threshold number
The threshold of the metric trigger.
thresholdOperator string
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.
metric_column str
Evaluation of metric on a particular column
metric_trigger_type str
Metric Trigger Type - ‘Consecutive’ or ‘Total’
threshold float
The threshold of the metric trigger.
threshold_operator str
Evaluation operation for Metric -‘GreaterThan’ or ‘LessThan’ or ‘Equal’.

LogToMetricAction

Criteria []Criteria
Criteria of Metric
criteria Criteria[]
Criteria of Metric
criteria Sequence[Criteria]
Criteria of Metric

LogToMetricActionResponse

Criteria []CriteriaResponse
Criteria of Metric
criteria CriteriaResponse[]
Criteria of Metric

MetricTriggerType

Consecutive
Consecutive
Total
Total
MetricTriggerTypeConsecutive
Consecutive
MetricTriggerTypeTotal
Total
Consecutive
Consecutive
Total
Total
CONSECUTIVE
Consecutive
TOTAL
Total

Operator

Include
Include
OperatorInclude
Include
Include
Include
INCLUDE
Include

QueryType

ResultCount
ResultCount
QueryTypeResultCount
ResultCount
ResultCount
ResultCount
RESULT_COUNT
ResultCount

Schedule

FrequencyInMinutes int
frequency (in minutes) at which rule condition should be evaluated.
TimeWindowInMinutes int
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).
FrequencyInMinutes int
frequency (in minutes) at which rule condition should be evaluated.
TimeWindowInMinutes int
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).
frequencyInMinutes number
frequency (in minutes) at which rule condition should be evaluated.
timeWindowInMinutes number
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).
frequency_in_minutes int
frequency (in minutes) at which rule condition should be evaluated.
time_window_in_minutes int
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).

ScheduleResponse

FrequencyInMinutes int
frequency (in minutes) at which rule condition should be evaluated.
TimeWindowInMinutes int
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).
FrequencyInMinutes int
frequency (in minutes) at which rule condition should be evaluated.
TimeWindowInMinutes int
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).
frequencyInMinutes number
frequency (in minutes) at which rule condition should be evaluated.
timeWindowInMinutes number
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).
frequency_in_minutes int
frequency (in minutes) at which rule condition should be evaluated.
time_window_in_minutes int
Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes).

Source

DataSourceId string
The resource uri over which log search query is to be run.
AuthorizedResources List<string>
List of Resource referred into query
Query string
Log search query. Required for action type - AlertingAction
QueryType string | Pulumi.AzureNative.Insights.QueryType
Set value to ‘ResultCount’ .
DataSourceId string
The resource uri over which log search query is to be run.
AuthorizedResources []string
List of Resource referred into query
Query string
Log search query. Required for action type - AlertingAction
QueryType string | QueryType
Set value to ‘ResultCount’ .
dataSourceId string
The resource uri over which log search query is to be run.
authorizedResources string[]
List of Resource referred into query
query string
Log search query. Required for action type - AlertingAction
queryType string | QueryType
Set value to ‘ResultCount’ .
data_source_id str
The resource uri over which log search query is to be run.
authorized_resources Sequence[str]
List of Resource referred into query
query str
Log search query. Required for action type - AlertingAction
query_type str | QueryType
Set value to ‘ResultCount’ .

SourceResponse

DataSourceId string
The resource uri over which log search query is to be run.
AuthorizedResources List<string>
List of Resource referred into query
Query string
Log search query. Required for action type - AlertingAction
QueryType string
Set value to ‘ResultCount’ .
DataSourceId string
The resource uri over which log search query is to be run.
AuthorizedResources []string
List of Resource referred into query
Query string
Log search query. Required for action type - AlertingAction
QueryType string
Set value to ‘ResultCount’ .
dataSourceId string
The resource uri over which log search query is to be run.
authorizedResources string[]
List of Resource referred into query
query string
Log search query. Required for action type - AlertingAction
queryType string
Set value to ‘ResultCount’ .
data_source_id str
The resource uri over which log search query is to be run.
authorized_resources Sequence[str]
List of Resource referred into query
query str
Log search query. Required for action type - AlertingAction
query_type str
Set value to ‘ResultCount’ .

TriggerCondition

Threshold double
Result or count threshold based on which rule should be triggered.
ThresholdOperator string | Pulumi.AzureNative.Insights.ConditionalOperator
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
MetricTrigger Pulumi.AzureNative.Insights.Inputs.LogMetricTrigger
Trigger condition for metric query rule
Threshold float64
Result or count threshold based on which rule should be triggered.
ThresholdOperator string | ConditionalOperator
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
MetricTrigger LogMetricTrigger
Trigger condition for metric query rule
threshold number
Result or count threshold based on which rule should be triggered.
thresholdOperator string | ConditionalOperator
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
metricTrigger LogMetricTrigger
Trigger condition for metric query rule
threshold float
Result or count threshold based on which rule should be triggered.
threshold_operator str | ConditionalOperator
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
metric_trigger LogMetricTrigger
Trigger condition for metric query rule

TriggerConditionResponse

Threshold double
Result or count threshold based on which rule should be triggered.
ThresholdOperator string
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
MetricTrigger Pulumi.AzureNative.Insights.Inputs.LogMetricTriggerResponse
Trigger condition for metric query rule
Threshold float64
Result or count threshold based on which rule should be triggered.
ThresholdOperator string
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
MetricTrigger LogMetricTriggerResponse
Trigger condition for metric query rule
threshold number
Result or count threshold based on which rule should be triggered.
thresholdOperator string
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
metricTrigger LogMetricTriggerResponse
Trigger condition for metric query rule
threshold float
Result or count threshold based on which rule should be triggered.
threshold_operator str
Evaluation operation for rule - ‘GreaterThan’ or ‘LessThan.
metric_trigger LogMetricTriggerResponse
Trigger condition for metric query rule

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:insights:ScheduledQueryRule logtometricfoo /subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/microsoft.insights/scheduledqueryrules/logtometricfoo 

Package Details

Repository
https://github.com/pulumi/pulumi-azure-native
License
Apache-2.0