getAlertRule

Use this data source to access information about an existing Sentinel Alert Rule.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.operationalinsights.getAnalyticsWorkspace({
name: "example",
resourceGroupName: "example-resources",
});
const exampleGetAlertRule = example.then(example => azure.sentinel.getAlertRule({
name: "existing",
logAnalyticsWorkspaceId: example.id,
}));
export const id = exampleGetAlertRule.then(exampleGetAlertRule => exampleGetAlertRule.id);
import pulumi
import pulumi_azure as azure
example = azure.operationalinsights.get_analytics_workspace(name="example",
resource_group_name="example-resources")
example_get_alert_rule = azure.sentinel.get_alert_rule(name="existing",
log_analytics_workspace_id=example.id)
pulumi.export("id", example_get_alert_rule.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.OperationalInsights.GetAnalyticsWorkspace.Invoke(new()
{
Name = "example",
ResourceGroupName = "example-resources",
});
var exampleGetAlertRule = Azure.Sentinel.GetAlertRule.Invoke(new()
{
Name = "existing",
LogAnalyticsWorkspaceId = example.Apply(getAnalyticsWorkspaceResult => getAnalyticsWorkspaceResult.Id),
});
return new Dictionary<string, object?>
{
["id"] = exampleGetAlertRule.Apply(getAlertRuleResult => getAlertRuleResult.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/operationalinsights"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/sentinel"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := operationalinsights.LookupAnalyticsWorkspace(ctx, &operationalinsights.LookupAnalyticsWorkspaceArgs{
Name: "example",
ResourceGroupName: "example-resources",
}, nil)
if err != nil {
return err
}
exampleGetAlertRule, err := sentinel.GetAlertRule(ctx, &sentinel.GetAlertRuleArgs{
Name: "existing",
LogAnalyticsWorkspaceId: example.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("id", exampleGetAlertRule.Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.operationalinsights.OperationalinsightsFunctions;
import com.pulumi.azure.operationalinsights.inputs.GetAnalyticsWorkspaceArgs;
import com.pulumi.azure.sentinel.SentinelFunctions;
import com.pulumi.azure.sentinel.inputs.GetAlertRuleArgs;
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) {
final var example = OperationalinsightsFunctions.getAnalyticsWorkspace(GetAnalyticsWorkspaceArgs.builder()
.name("example")
.resourceGroupName("example-resources")
.build());
final var exampleGetAlertRule = SentinelFunctions.getAlertRule(GetAlertRuleArgs.builder()
.name("existing")
.logAnalyticsWorkspaceId(example.applyValue(getAnalyticsWorkspaceResult -> getAnalyticsWorkspaceResult.id()))
.build());
ctx.export("id", exampleGetAlertRule.applyValue(getAlertRuleResult -> getAlertRuleResult.id()));
}
}
variables:
example:
fn::invoke:
function: azure:operationalinsights:getAnalyticsWorkspace
arguments:
name: example
resourceGroupName: example-resources
exampleGetAlertRule:
fn::invoke:
function: azure:sentinel:getAlertRule
arguments:
name: existing
logAnalyticsWorkspaceId: ${example.id}
outputs:
id: ${exampleGetAlertRule.id}

Return

A collection of values returned by getAlertRule.

Parameters

argument

A collection of arguments for invoking getAlertRule.


suspend fun getAlertRule(logAnalyticsWorkspaceId: String, name: String): GetAlertRuleResult

Return

A collection of values returned by getAlertRule.

Parameters

logAnalyticsWorkspaceId

The ID of the Log Analytics Workspace this Sentinel Alert Rule belongs to.

name

The name which should be used for this Sentinel Alert Rule.

See also


Return

A collection of values returned by getAlertRule.

Parameters

argument

Builder for com.pulumi.azure.sentinel.kotlin.inputs.GetAlertRulePlainArgs.

See also