ScheduledQueryRuleArgs

data class ScheduledQueryRuleArgs(val actions: Output<ActionsArgs>? = null, val autoMitigate: Output<Boolean>? = null, val checkWorkspaceAlertsStorageConfigured: Output<Boolean>? = null, val criteria: Output<ScheduledQueryRuleCriteriaArgs>? = null, val description: Output<String>? = null, val displayName: Output<String>? = null, val enabled: Output<Boolean>? = null, val evaluationFrequency: Output<String>? = null, val identity: Output<IdentityArgs>? = null, val kind: Output<Either<String, Kind>>? = null, val location: Output<String>? = null, val muteActionsDuration: Output<String>? = null, val overrideQueryTimeRange: Output<String>? = null, val resolveConfiguration: Output<RuleResolveConfigurationArgs>? = null, val resourceGroupName: Output<String>? = null, val ruleName: Output<String>? = null, val scopes: Output<List<String>>? = null, val severity: Output<Double>? = null, val skipQueryValidation: Output<Boolean>? = null, val tags: Output<Map<String, String>>? = null, val targetResourceTypes: Output<List<String>>? = null, val windowSize: Output<String>? = null) : ConvertibleToJava<ScheduledQueryRuleArgs>

The scheduled query rule resource. Uses Azure REST API version 2023-03-15-preview. In version 1.x of the Azure Native provider, it used API version 2018-04-16. Other available API versions: 2018-04-16, 2020-05-01-preview, 2022-08-01-preview, 2023-12-01, 2024-01-01-preview, 2025-01-01-preview.

Example Usage

Create or update a scheduled query rule for Single Resource

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var scheduledQueryRule = new AzureNative.Insights.ScheduledQueryRule("scheduledQueryRule", new()
{
Actions = new AzureNative.Insights.Inputs.ActionsArgs
{
ActionGroups = new[]
{
"/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup",
},
CustomProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
CheckWorkspaceAlertsStorageConfigured = true,
Criteria = new AzureNative.Insights.Inputs.ScheduledQueryRuleCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.ConditionArgs
{
Dimensions = new[]
{
new AzureNative.Insights.Inputs.DimensionArgs
{
Name = "ComputerIp",
Operator = AzureNative.Insights.DimensionOperator.Exclude,
Values = new[]
{
"192.168.1.1",
},
},
new AzureNative.Insights.Inputs.DimensionArgs
{
Name = "OSType",
Operator = AzureNative.Insights.DimensionOperator.Include,
Values = new[]
{
"*",
},
},
},
FailingPeriods = new AzureNative.Insights.Inputs.ConditionFailingPeriodsArgs
{
MinFailingPeriodsToAlert = 1,
NumberOfEvaluationPeriods = 1,
},
MetricMeasureColumn = "% Processor Time",
Operator = AzureNative.Insights.ConditionOperator.GreaterThan,
Query = "Perf | where ObjectName == \"Processor\"",
ResourceIdColumn = "resourceId",
Threshold = 70,
TimeAggregation = AzureNative.Insights.TimeAggregation.Average,
},
},
},
Description = "Performance rule",
Enabled = true,
EvaluationFrequency = "PT5M",
Location = "eastus",
MuteActionsDuration = "PT30M",
ResolveConfiguration = new AzureNative.Insights.Inputs.RuleResolveConfigurationArgs
{
AutoResolved = true,
TimeToResolve = "PT10M",
},
ResourceGroupName = "QueryResourceGroupName",
RuleName = "perf",
Scopes = new[]
{
"/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1",
},
Severity = 4,
SkipQueryValidation = true,
WindowSize = "PT10M",
});
});
package main
import (
insights "github.com/pulumi/pulumi-azure-native-sdk/insights/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := insights.NewScheduledQueryRule(ctx, "scheduledQueryRule", &insights.ScheduledQueryRuleArgs{
Actions: &insights.ActionsArgs{
ActionGroups: pulumi.StringArray{
pulumi.String("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"),
},
CustomProperties: pulumi.StringMap{
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
CheckWorkspaceAlertsStorageConfigured: pulumi.Bool(true),
Criteria: &insights.ScheduledQueryRuleCriteriaArgs{
AllOf: insights.ConditionArray{
&insights.ConditionArgs{
Dimensions: insights.DimensionArray{
&insights.DimensionArgs{
Name: pulumi.String("ComputerIp"),
Operator: pulumi.String(insights.DimensionOperatorExclude),
Values: pulumi.StringArray{
pulumi.String("192.168.1.1"),
},
},
&insights.DimensionArgs{
Name: pulumi.String("OSType"),
Operator: pulumi.String(insights.DimensionOperatorInclude),
Values: pulumi.StringArray{
pulumi.String("*"),
},
},
},
FailingPeriods: &insights.ConditionFailingPeriodsArgs{
MinFailingPeriodsToAlert: pulumi.Float64(1),
NumberOfEvaluationPeriods: pulumi.Float64(1),
},
MetricMeasureColumn: pulumi.String("% Processor Time"),
Operator: pulumi.String(insights.ConditionOperatorGreaterThan),
Query: pulumi.String("Perf | where ObjectName == \"Processor\""),
ResourceIdColumn: pulumi.String("resourceId"),
Threshold: pulumi.Float64(70),
TimeAggregation: pulumi.String(insights.TimeAggregationAverage),
},
},
},
Description: pulumi.String("Performance rule"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT5M"),
Location: pulumi.String("eastus"),
MuteActionsDuration: pulumi.String("PT30M"),
ResolveConfiguration: &insights.RuleResolveConfigurationArgs{
AutoResolved: pulumi.Bool(true),
TimeToResolve: pulumi.String("PT10M"),
},
ResourceGroupName: pulumi.String("QueryResourceGroupName"),
RuleName: pulumi.String("perf"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1"),
},
Severity: pulumi.Float64(4),
SkipQueryValidation: pulumi.Bool(true),
WindowSize: pulumi.String("PT10M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.ScheduledQueryRule;
import com.pulumi.azurenative.insights.ScheduledQueryRuleArgs;
import com.pulumi.azurenative.insights.inputs.ActionsArgs;
import com.pulumi.azurenative.insights.inputs.ScheduledQueryRuleCriteriaArgs;
import com.pulumi.azurenative.insights.inputs.RuleResolveConfigurationArgs;
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 scheduledQueryRule = new ScheduledQueryRule("scheduledQueryRule", ScheduledQueryRuleArgs.builder()
.actions(ActionsArgs.builder()
.actionGroups("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")
.customProperties(Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
.build())
.checkWorkspaceAlertsStorageConfigured(true)
.criteria(ScheduledQueryRuleCriteriaArgs.builder()
.allOf(ConditionArgs.builder()
.dimensions(
DimensionArgs.builder()
.name("ComputerIp")
.operator("Exclude")
.values("192.168.1.1")
.build(),
DimensionArgs.builder()
.name("OSType")
.operator("Include")
.values("*")
.build())
.failingPeriods(ConditionFailingPeriodsArgs.builder()
.minFailingPeriodsToAlert(1)
.numberOfEvaluationPeriods(1)
.build())
.metricMeasureColumn("% Processor Time")
.operator("GreaterThan")
.query("Perf | where ObjectName == \"Processor\"")
.resourceIdColumn("resourceId")
.threshold(70)
.timeAggregation("Average")
.build())
.build())
.description("Performance rule")
.enabled(true)
.evaluationFrequency("PT5M")
.location("eastus")
.muteActionsDuration("PT30M")
.resolveConfiguration(RuleResolveConfigurationArgs.builder()
.autoResolved(true)
.timeToResolve("PT10M")
.build())
.resourceGroupName("QueryResourceGroupName")
.ruleName("perf")
.scopes("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")
.severity(4)
.skipQueryValidation(true)
.windowSize("PT10M")
.build());
}
}

Create or update a scheduled query rule on Resource group(s)

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var scheduledQueryRule = new AzureNative.Insights.ScheduledQueryRule("scheduledQueryRule", new()
{
Actions = new AzureNative.Insights.Inputs.ActionsArgs
{
ActionGroups = new[]
{
"/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup",
},
CustomProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
CheckWorkspaceAlertsStorageConfigured = true,
Criteria = new AzureNative.Insights.Inputs.ScheduledQueryRuleCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.ConditionArgs
{
Dimensions = new() { },
FailingPeriods = new AzureNative.Insights.Inputs.ConditionFailingPeriodsArgs
{
MinFailingPeriodsToAlert = 1,
NumberOfEvaluationPeriods = 1,
},
Operator = AzureNative.Insights.ConditionOperator.GreaterThan,
Query = "Heartbeat",
Threshold = 360,
TimeAggregation = AzureNative.Insights.TimeAggregation.Count,
},
},
},
Description = "Health check rule",
Enabled = true,
EvaluationFrequency = "PT5M",
Location = "eastus",
MuteActionsDuration = "PT30M",
ResolveConfiguration = new AzureNative.Insights.Inputs.RuleResolveConfigurationArgs
{
AutoResolved = true,
TimeToResolve = "PT10M",
},
ResourceGroupName = "QueryResourceGroupName",
RuleName = "heartbeat",
Scopes = new[]
{
"/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1",
},
Severity = 4,
SkipQueryValidation = true,
TargetResourceTypes = new[]
{
"Microsoft.Compute/virtualMachines",
},
WindowSize = "PT10M",
});
});
package main
import (
insights "github.com/pulumi/pulumi-azure-native-sdk/insights/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := insights.NewScheduledQueryRule(ctx, "scheduledQueryRule", &insights.ScheduledQueryRuleArgs{
Actions: &insights.ActionsArgs{
ActionGroups: pulumi.StringArray{
pulumi.String("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"),
},
CustomProperties: pulumi.StringMap{
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
CheckWorkspaceAlertsStorageConfigured: pulumi.Bool(true),
Criteria: &insights.ScheduledQueryRuleCriteriaArgs{
AllOf: insights.ConditionArray{
&insights.ConditionArgs{
Dimensions: insights.DimensionArray{},
FailingPeriods: &insights.ConditionFailingPeriodsArgs{
MinFailingPeriodsToAlert: pulumi.Float64(1),
NumberOfEvaluationPeriods: pulumi.Float64(1),
},
Operator: pulumi.String(insights.ConditionOperatorGreaterThan),
Query: pulumi.String("Heartbeat"),
Threshold: pulumi.Float64(360),
TimeAggregation: pulumi.String(insights.TimeAggregationCount),
},
},
},
Description: pulumi.String("Health check rule"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT5M"),
Location: pulumi.String("eastus"),
MuteActionsDuration: pulumi.String("PT30M"),
ResolveConfiguration: &insights.RuleResolveConfigurationArgs{
AutoResolved: pulumi.Bool(true),
TimeToResolve: pulumi.String("PT10M"),
},
ResourceGroupName: pulumi.String("QueryResourceGroupName"),
RuleName: pulumi.String("heartbeat"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1"),
},
Severity: pulumi.Float64(4),
SkipQueryValidation: pulumi.Bool(true),
TargetResourceTypes: pulumi.StringArray{
pulumi.String("Microsoft.Compute/virtualMachines"),
},
WindowSize: pulumi.String("PT10M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.ScheduledQueryRule;
import com.pulumi.azurenative.insights.ScheduledQueryRuleArgs;
import com.pulumi.azurenative.insights.inputs.ActionsArgs;
import com.pulumi.azurenative.insights.inputs.ScheduledQueryRuleCriteriaArgs;
import com.pulumi.azurenative.insights.inputs.RuleResolveConfigurationArgs;
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 scheduledQueryRule = new ScheduledQueryRule("scheduledQueryRule", ScheduledQueryRuleArgs.builder()
.actions(ActionsArgs.builder()
.actionGroups("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")
.customProperties(Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
.build())
.checkWorkspaceAlertsStorageConfigured(true)
.criteria(ScheduledQueryRuleCriteriaArgs.builder()
.allOf(ConditionArgs.builder()
.dimensions()
.failingPeriods(ConditionFailingPeriodsArgs.builder()
.minFailingPeriodsToAlert(1)
.numberOfEvaluationPeriods(1)
.build())
.operator("GreaterThan")
.query("Heartbeat")
.threshold(360)
.timeAggregation("Count")
.build())
.build())
.description("Health check rule")
.enabled(true)
.evaluationFrequency("PT5M")
.location("eastus")
.muteActionsDuration("PT30M")
.resolveConfiguration(RuleResolveConfigurationArgs.builder()
.autoResolved(true)
.timeToResolve("PT10M")
.build())
.resourceGroupName("QueryResourceGroupName")
.ruleName("heartbeat")
.scopes("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")
.severity(4)
.skipQueryValidation(true)
.targetResourceTypes("Microsoft.Compute/virtualMachines")
.windowSize("PT10M")
.build());
}
}

Create or update a scheduled query rule on Subscription

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var scheduledQueryRule = new AzureNative.Insights.ScheduledQueryRule("scheduledQueryRule", new()
{
Actions = new AzureNative.Insights.Inputs.ActionsArgs
{
ActionGroups = new[]
{
"/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup",
},
CustomProperties =
{
{ "key11", "value11" },
{ "key12", "value12" },
},
},
CheckWorkspaceAlertsStorageConfigured = true,
Criteria = new AzureNative.Insights.Inputs.ScheduledQueryRuleCriteriaArgs
{
AllOf = new[]
{
new AzureNative.Insights.Inputs.ConditionArgs
{
Dimensions = new[]
{
new AzureNative.Insights.Inputs.DimensionArgs
{
Name = "ComputerIp",
Operator = AzureNative.Insights.DimensionOperator.Exclude,
Values = new[]
{
"192.168.1.1",
},
},
new AzureNative.Insights.Inputs.DimensionArgs
{
Name = "OSType",
Operator = AzureNative.Insights.DimensionOperator.Include,
Values = new[]
{
"*",
},
},
},
FailingPeriods = new AzureNative.Insights.Inputs.ConditionFailingPeriodsArgs
{
MinFailingPeriodsToAlert = 1,
NumberOfEvaluationPeriods = 1,
},
MetricMeasureColumn = "% Processor Time",
Operator = AzureNative.Insights.ConditionOperator.GreaterThan,
Query = "Perf | where ObjectName == \"Processor\"",
ResourceIdColumn = "resourceId",
Threshold = 70,
TimeAggregation = AzureNative.Insights.TimeAggregation.Average,
},
},
},
Description = "Performance rule",
Enabled = true,
EvaluationFrequency = "PT5M",
Location = "eastus",
MuteActionsDuration = "PT30M",
ResolveConfiguration = new AzureNative.Insights.Inputs.RuleResolveConfigurationArgs
{
AutoResolved = true,
TimeToResolve = "PT10M",
},
ResourceGroupName = "QueryResourceGroupName",
RuleName = "perf",
Scopes = new[]
{
"/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147",
},
Severity = 4,
SkipQueryValidation = true,
TargetResourceTypes = new[]
{
"Microsoft.Compute/virtualMachines",
},
WindowSize = "PT10M",
});
});
package main
import (
insights "github.com/pulumi/pulumi-azure-native-sdk/insights/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := insights.NewScheduledQueryRule(ctx, "scheduledQueryRule", &insights.ScheduledQueryRuleArgs{
Actions: &insights.ActionsArgs{
ActionGroups: pulumi.StringArray{
pulumi.String("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup"),
},
CustomProperties: pulumi.StringMap{
"key11": pulumi.String("value11"),
"key12": pulumi.String("value12"),
},
},
CheckWorkspaceAlertsStorageConfigured: pulumi.Bool(true),
Criteria: &insights.ScheduledQueryRuleCriteriaArgs{
AllOf: insights.ConditionArray{
&insights.ConditionArgs{
Dimensions: insights.DimensionArray{
&insights.DimensionArgs{
Name: pulumi.String("ComputerIp"),
Operator: pulumi.String(insights.DimensionOperatorExclude),
Values: pulumi.StringArray{
pulumi.String("192.168.1.1"),
},
},
&insights.DimensionArgs{
Name: pulumi.String("OSType"),
Operator: pulumi.String(insights.DimensionOperatorInclude),
Values: pulumi.StringArray{
pulumi.String("*"),
},
},
},
FailingPeriods: &insights.ConditionFailingPeriodsArgs{
MinFailingPeriodsToAlert: pulumi.Float64(1),
NumberOfEvaluationPeriods: pulumi.Float64(1),
},
MetricMeasureColumn: pulumi.String("% Processor Time"),
Operator: pulumi.String(insights.ConditionOperatorGreaterThan),
Query: pulumi.String("Perf | where ObjectName == \"Processor\""),
ResourceIdColumn: pulumi.String("resourceId"),
Threshold: pulumi.Float64(70),
TimeAggregation: pulumi.String(insights.TimeAggregationAverage),
},
},
},
Description: pulumi.String("Performance rule"),
Enabled: pulumi.Bool(true),
EvaluationFrequency: pulumi.String("PT5M"),
Location: pulumi.String("eastus"),
MuteActionsDuration: pulumi.String("PT30M"),
ResolveConfiguration: &insights.RuleResolveConfigurationArgs{
AutoResolved: pulumi.Bool(true),
TimeToResolve: pulumi.String("PT10M"),
},
ResourceGroupName: pulumi.String("QueryResourceGroupName"),
RuleName: pulumi.String("perf"),
Scopes: pulumi.StringArray{
pulumi.String("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147"),
},
Severity: pulumi.Float64(4),
SkipQueryValidation: pulumi.Bool(true),
TargetResourceTypes: pulumi.StringArray{
pulumi.String("Microsoft.Compute/virtualMachines"),
},
WindowSize: pulumi.String("PT10M"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.insights.ScheduledQueryRule;
import com.pulumi.azurenative.insights.ScheduledQueryRuleArgs;
import com.pulumi.azurenative.insights.inputs.ActionsArgs;
import com.pulumi.azurenative.insights.inputs.ScheduledQueryRuleCriteriaArgs;
import com.pulumi.azurenative.insights.inputs.RuleResolveConfigurationArgs;
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 scheduledQueryRule = new ScheduledQueryRule("scheduledQueryRule", ScheduledQueryRuleArgs.builder()
.actions(ActionsArgs.builder()
.actionGroups("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")
.customProperties(Map.ofEntries(
Map.entry("key11", "value11"),
Map.entry("key12", "value12")
))
.build())
.checkWorkspaceAlertsStorageConfigured(true)
.criteria(ScheduledQueryRuleCriteriaArgs.builder()
.allOf(ConditionArgs.builder()
.dimensions(
DimensionArgs.builder()
.name("ComputerIp")
.operator("Exclude")
.values("192.168.1.1")
.build(),
DimensionArgs.builder()
.name("OSType")
.operator("Include")
.values("*")
.build())
.failingPeriods(ConditionFailingPeriodsArgs.builder()
.minFailingPeriodsToAlert(1)
.numberOfEvaluationPeriods(1)
.build())
.metricMeasureColumn("% Processor Time")
.operator("GreaterThan")
.query("Perf | where ObjectName == \"Processor\"")
.resourceIdColumn("resourceId")
.threshold(70)
.timeAggregation("Average")
.build())
.build())
.description("Performance rule")
.enabled(true)
.evaluationFrequency("PT5M")
.location("eastus")
.muteActionsDuration("PT30M")
.resolveConfiguration(RuleResolveConfigurationArgs.builder()
.autoResolved(true)
.timeToResolve("PT10M")
.build())
.resourceGroupName("QueryResourceGroupName")
.ruleName("perf")
.scopes("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")
.severity(4)
.skipQueryValidation(true)
.targetResourceTypes("Microsoft.Compute/virtualMachines")
.windowSize("PT10M")
.build());
}
}

Import

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

$ pulumi import azure-native:insights:ScheduledQueryRule perf /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}

Constructors

Link copied to clipboard
constructor(actions: Output<ActionsArgs>? = null, autoMitigate: Output<Boolean>? = null, checkWorkspaceAlertsStorageConfigured: Output<Boolean>? = null, criteria: Output<ScheduledQueryRuleCriteriaArgs>? = null, description: Output<String>? = null, displayName: Output<String>? = null, enabled: Output<Boolean>? = null, evaluationFrequency: Output<String>? = null, identity: Output<IdentityArgs>? = null, kind: Output<Either<String, Kind>>? = null, location: Output<String>? = null, muteActionsDuration: Output<String>? = null, overrideQueryTimeRange: Output<String>? = null, resolveConfiguration: Output<RuleResolveConfigurationArgs>? = null, resourceGroupName: Output<String>? = null, ruleName: Output<String>? = null, scopes: Output<List<String>>? = null, severity: Output<Double>? = null, skipQueryValidation: Output<Boolean>? = null, tags: Output<Map<String, String>>? = null, targetResourceTypes: Output<List<String>>? = null, windowSize: Output<String>? = null)

Properties

Link copied to clipboard
val actions: Output<ActionsArgs>? = null

Actions to invoke when the alert fires.

Link copied to clipboard
val autoMitigate: Output<Boolean>? = null

The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for rules of the kind LogAlert.

Link copied to clipboard

The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind LogAlert.

Link copied to clipboard

The rule criteria that defines the conditions of the scheduled query rule.

Link copied to clipboard
val description: Output<String>? = null

The description of the scheduled query rule.

Link copied to clipboard
val displayName: Output<String>? = null

The display name of the alert rule

Link copied to clipboard
val enabled: Output<Boolean>? = null

The flag which indicates whether this scheduled query rule is enabled. Value should be true or false

Link copied to clipboard
val evaluationFrequency: Output<String>? = null

How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert.

Link copied to clipboard
val identity: Output<IdentityArgs>? = null

The identity of the resource.

Link copied to clipboard
val kind: Output<Either<String, Kind>>? = null

Indicates the type of scheduled query rule. The default is LogAlert.

Link copied to clipboard
val location: Output<String>? = null

The geo-location where the resource lives

Link copied to clipboard
val muteActionsDuration: Output<String>? = null

Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules of the kind LogAlert.

Link copied to clipboard
val overrideQueryTimeRange: Output<String>? = null

If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert.

Link copied to clipboard

Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the resource group. The name is case insensitive.

Link copied to clipboard
val ruleName: Output<String>? = null

The name of the rule.

Link copied to clipboard
val scopes: Output<List<String>>? = null

The list of resource id's that this scheduled query rule is scoped to.

Link copied to clipboard
val severity: Output<Double>? = null

Severity of the alert. Should be an integer between 0-4. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert.

Link copied to clipboard
val skipQueryValidation: Output<Boolean>? = null

The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for rules of the kind LogAlert.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

Resource tags.

Link copied to clipboard
val targetResourceTypes: Output<List<String>>? = null

List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert

Link copied to clipboard
val windowSize: Output<String>? = null

The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required only for rules of the kind LogAlert.

Functions

Link copied to clipboard
open override fun toJava(): ScheduledQueryRuleArgs