Activity Log Alert Args
data class ActivityLogAlertArgs(val actions: Output<List<ActivityLogAlertActionArgs>>? = null, val criteria: Output<ActivityLogAlertCriteriaArgs>? = null, val description: Output<String>? = null, val enabled: Output<Boolean>? = null, val location: Output<String>? = null, val name: Output<String>? = null, val resourceGroupName: Output<String>? = null, val scopes: Output<List<String>>? = null, val tags: Output<Map<String, String>>? = null) : ConvertibleToJava<ActivityLogAlertArgs>
Manages an Activity Log 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 main = new azure.monitoring.ActionGroup("main", {
name: "example-actiongroup",
resourceGroupName: example.name,
shortName: "p0action",
webhookReceivers: [{
name: "callmyapi",
serviceUri: "http://example.com/alert",
}],
});
const toMonitor = new azure.storage.Account("to_monitor", {
name: "examplesa",
resourceGroupName: example.name,
location: example.location,
accountTier: "Standard",
accountReplicationType: "GRS",
});
const mainActivityLogAlert = new azure.monitoring.ActivityLogAlert("main", {
name: "example-activitylogalert",
resourceGroupName: example.name,
location: example.location,
scopes: [example.id],
description: "This alert will monitor a specific storage account updates.",
criteria: {
resourceId: toMonitor.id,
operationName: "Microsoft.Storage/storageAccounts/write",
category: "Recommendation",
},
actions: [{
actionGroupId: main.id,
webhookProperties: {
from: "source",
},
}],
});
Content copied to clipboard
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
main = azure.monitoring.ActionGroup("main",
name="example-actiongroup",
resource_group_name=example.name,
short_name="p0action",
webhook_receivers=[{
"name": "callmyapi",
"service_uri": "http://example.com/alert",
}])
to_monitor = azure.storage.Account("to_monitor",
name="examplesa",
resource_group_name=example.name,
location=example.location,
account_tier="Standard",
account_replication_type="GRS")
main_activity_log_alert = azure.monitoring.ActivityLogAlert("main",
name="example-activitylogalert",
resource_group_name=example.name,
location=example.location,
scopes=[example.id],
description="This alert will monitor a specific storage account updates.",
criteria={
"resource_id": to_monitor.id,
"operation_name": "Microsoft.Storage/storageAccounts/write",
"category": "Recommendation",
},
actions=[{
"action_group_id": main.id,
"webhook_properties": {
"from": "source",
},
}])
Content copied to clipboard
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 main = new Azure.Monitoring.ActionGroup("main", new()
{
Name = "example-actiongroup",
ResourceGroupName = example.Name,
ShortName = "p0action",
WebhookReceivers = new[]
{
new Azure.Monitoring.Inputs.ActionGroupWebhookReceiverArgs
{
Name = "callmyapi",
ServiceUri = "http://example.com/alert",
},
},
});
var toMonitor = new Azure.Storage.Account("to_monitor", new()
{
Name = "examplesa",
ResourceGroupName = example.Name,
Location = example.Location,
AccountTier = "Standard",
AccountReplicationType = "GRS",
});
var mainActivityLogAlert = new Azure.Monitoring.ActivityLogAlert("main", new()
{
Name = "example-activitylogalert",
ResourceGroupName = example.Name,
Location = example.Location,
Scopes = new[]
{
example.Id,
},
Description = "This alert will monitor a specific storage account updates.",
Criteria = new Azure.Monitoring.Inputs.ActivityLogAlertCriteriaArgs
{
ResourceId = toMonitor.Id,
OperationName = "Microsoft.Storage/storageAccounts/write",
Category = "Recommendation",
},
Actions = new[]
{
new Azure.Monitoring.Inputs.ActivityLogAlertActionArgs
{
ActionGroupId = main.Id,
WebhookProperties =
{
{ "from", "source" },
},
},
},
});
});
Content copied to clipboard
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
}
main, err := monitoring.NewActionGroup(ctx, "main", &monitoring.ActionGroupArgs{
Name: pulumi.String("example-actiongroup"),
ResourceGroupName: example.Name,
ShortName: pulumi.String("p0action"),
WebhookReceivers: monitoring.ActionGroupWebhookReceiverArray{
&monitoring.ActionGroupWebhookReceiverArgs{
Name: pulumi.String("callmyapi"),
ServiceUri: pulumi.String("http://example.com/alert"),
},
},
})
if err != nil {
return err
}
toMonitor, err := storage.NewAccount(ctx, "to_monitor", &storage.AccountArgs{
Name: pulumi.String("examplesa"),
ResourceGroupName: example.Name,
Location: example.Location,
AccountTier: pulumi.String("Standard"),
AccountReplicationType: pulumi.String("GRS"),
})
if err != nil {
return err
}
_, err = monitoring.NewActivityLogAlert(ctx, "main", &monitoring.ActivityLogAlertArgs{
Name: pulumi.String("example-activitylogalert"),
ResourceGroupName: example.Name,
Location: example.Location,
Scopes: pulumi.StringArray{
example.ID(),
},
Description: pulumi.String("This alert will monitor a specific storage account updates."),
Criteria: &monitoring.ActivityLogAlertCriteriaArgs{
ResourceId: toMonitor.ID(),
OperationName: pulumi.String("Microsoft.Storage/storageAccounts/write"),
Category: pulumi.String("Recommendation"),
},
Actions: monitoring.ActivityLogAlertActionArray{
&monitoring.ActivityLogAlertActionArgs{
ActionGroupId: main.ID(),
WebhookProperties: pulumi.StringMap{
"from": pulumi.String("source"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
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.monitoring.ActionGroup;
import com.pulumi.azure.monitoring.ActionGroupArgs;
import com.pulumi.azure.monitoring.inputs.ActionGroupWebhookReceiverArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.monitoring.ActivityLogAlert;
import com.pulumi.azure.monitoring.ActivityLogAlertArgs;
import com.pulumi.azure.monitoring.inputs.ActivityLogAlertCriteriaArgs;
import com.pulumi.azure.monitoring.inputs.ActivityLogAlertActionArgs;
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 main = new ActionGroup("main", ActionGroupArgs.builder()
.name("example-actiongroup")
.resourceGroupName(example.name())
.shortName("p0action")
.webhookReceivers(ActionGroupWebhookReceiverArgs.builder()
.name("callmyapi")
.serviceUri("http://example.com/alert")
.build())
.build());
var toMonitor = new Account("toMonitor", AccountArgs.builder()
.name("examplesa")
.resourceGroupName(example.name())
.location(example.location())
.accountTier("Standard")
.accountReplicationType("GRS")
.build());
var mainActivityLogAlert = new ActivityLogAlert("mainActivityLogAlert", ActivityLogAlertArgs.builder()
.name("example-activitylogalert")
.resourceGroupName(example.name())
.location(example.location())
.scopes(example.id())
.description("This alert will monitor a specific storage account updates.")
.criteria(ActivityLogAlertCriteriaArgs.builder()
.resourceId(toMonitor.id())
.operationName("Microsoft.Storage/storageAccounts/write")
.category("Recommendation")
.build())
.actions(ActivityLogAlertActionArgs.builder()
.actionGroupId(main.id())
.webhookProperties(Map.of("from", "source"))
.build())
.build());
}
}
Content copied to clipboard
resources:
example:
type: azure:core:ResourceGroup
properties:
name: example-resources
location: West Europe
main:
type: azure:monitoring:ActionGroup
properties:
name: example-actiongroup
resourceGroupName: ${example.name}
shortName: p0action
webhookReceivers:
- name: callmyapi
serviceUri: http://example.com/alert
toMonitor:
type: azure:storage:Account
name: to_monitor
properties:
name: examplesa
resourceGroupName: ${example.name}
location: ${example.location}
accountTier: Standard
accountReplicationType: GRS
mainActivityLogAlert:
type: azure:monitoring:ActivityLogAlert
name: main
properties:
name: example-activitylogalert
resourceGroupName: ${example.name}
location: ${example.location}
scopes:
- ${example.id}
description: This alert will monitor a specific storage account updates.
criteria:
resourceId: ${toMonitor.id}
operationName: Microsoft.Storage/storageAccounts/write
category: Recommendation
actions:
- actionGroupId: ${main.id}
webhookProperties:
from: source
Content copied to clipboard
Import
Activity log alerts can be imported using the resource id
, e.g.
$ pulumi import azure:monitoring/activityLogAlert:ActivityLogAlert example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Insights/activityLogAlerts/myalertname
Content copied to clipboard
Constructors
Link copied to clipboard
constructor(actions: Output<List<ActivityLogAlertActionArgs>>? = null, criteria: Output<ActivityLogAlertCriteriaArgs>? = null, description: Output<String>? = null, enabled: Output<Boolean>? = null, location: Output<String>? = null, name: Output<String>? = null, resourceGroupName: Output<String>? = null, scopes: Output<List<String>>? = null, tags: Output<Map<String, String>>? = null)
Properties
Link copied to clipboard
One or more action
blocks as defined below.
Link copied to clipboard
A criteria
block as defined below.
Link copied to clipboard
The description of this activity log alert.
Link copied to clipboard
The name of the resource group in which to create the activity log alert instance. Changing this forces a new resource to be created.