GetAlertRule
Use this data source to access information about an existing Sentinel Alert Rule.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var exampleAnalyticsWorkspace = Output.Create(Azure.OperationalInsights.GetAnalyticsWorkspace.InvokeAsync(new Azure.OperationalInsights.GetAnalyticsWorkspaceArgs
{
Name = "example",
ResourceGroupName = "example-resources",
}));
var exampleAlertRule = exampleAnalyticsWorkspace.Apply(exampleAnalyticsWorkspace => Output.Create(Azure.Sentinel.GetAlertRule.InvokeAsync(new Azure.Sentinel.GetAlertRuleArgs
{
Name = "existing",
LogAnalyticsWorkspaceId = exampleAnalyticsWorkspace.Id,
})));
this.Id = exampleAlertRule.Apply(exampleAlertRule => exampleAlertRule.Id);
}
[Output("id")]
public Output<string> Id { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/operationalinsights"
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/sentinel"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleAnalyticsWorkspace, err := operationalinsights.LookupAnalyticsWorkspace(ctx, &operationalinsights.LookupAnalyticsWorkspaceArgs{
Name: "example",
ResourceGroupName: "example-resources",
}, nil)
if err != nil {
return err
}
exampleAlertRule, err := sentinel.GetAlertRule(ctx, &sentinel.GetAlertRuleArgs{
Name: "existing",
LogAnalyticsWorkspaceId: exampleAnalyticsWorkspace.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("id", exampleAlertRule.Id)
return nil
})
}import pulumi
import pulumi_azure as azure
example_analytics_workspace = azure.operationalinsights.get_analytics_workspace(name="example",
resource_group_name="example-resources")
example_alert_rule = azure.sentinel.get_alert_rule(name="existing",
log_analytics_workspace_id=example_analytics_workspace.id)
pulumi.export("id", example_alert_rule.id)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleAnalyticsWorkspace = azure.operationalinsights.getAnalyticsWorkspace({
name: "example",
resourceGroupName: "example-resources",
});
const exampleAlertRule = exampleAnalyticsWorkspace.then(exampleAnalyticsWorkspace => azure.sentinel.getAlertRule({
name: "existing",
logAnalyticsWorkspaceId: exampleAnalyticsWorkspace.id,
}));
export const id = exampleAlertRule.then(exampleAlertRule => exampleAlertRule.id);Using GetAlertRule
function getAlertRule(args: GetAlertRuleArgs, opts?: InvokeOptions): Promise<GetAlertRuleResult>function get_alert_rule(log_analytics_workspace_id=None, name=None, opts=None)func GetAlertRule(ctx *Context, args *GetAlertRuleArgs, opts ...InvokeOption) (*GetAlertRuleResult, error)public static class GetAlertRule {
public static Task<GetAlertRuleResult> InvokeAsync(GetAlertRuleArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Log
Analytics stringWorkspace Id The ID of the Log Analytics Workspace this Sentinel Alert Rule belongs to.
- Name string
The name which should be used for this Sentinel Alert Rule.
- Log
Analytics stringWorkspace Id The ID of the Log Analytics Workspace this Sentinel Alert Rule belongs to.
- Name string
The name which should be used for this Sentinel Alert Rule.
- log
Analytics stringWorkspace Id The ID of the Log Analytics Workspace this Sentinel Alert Rule belongs to.
- name string
The name which should be used for this Sentinel Alert Rule.
- log_
analytics_ strworkspace_ id The ID of the Log Analytics Workspace this Sentinel Alert Rule belongs to.
- name str
The name which should be used for this Sentinel Alert Rule.
GetAlertRule Result
The following output properties are available:
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.