com.pulumi.azure.monitoring.kotlin.AadDiagnosticSettingArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-azure-kotlin Show documentation
Show all versions of pulumi-azure-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.monitoring.kotlin
import com.pulumi.azure.monitoring.AadDiagnosticSettingArgs.builder
import com.pulumi.azure.monitoring.kotlin.inputs.AadDiagnosticSettingEnabledLogArgs
import com.pulumi.azure.monitoring.kotlin.inputs.AadDiagnosticSettingEnabledLogArgsBuilder
import com.pulumi.azure.monitoring.kotlin.inputs.AadDiagnosticSettingLogArgs
import com.pulumi.azure.monitoring.kotlin.inputs.AadDiagnosticSettingLogArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Manages an Azure Active Directory Diagnostic Setting for Azure Monitor.
* !> **Authentication** The API for this resource does not support service principal authentication. This resource can only be used with Azure CLI authentication.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-rg",
* location: "west europe",
* });
* const exampleAccount = new azure.storage.Account("example", {
* name: "examplestorageaccount",
* resourceGroupName: example.name,
* location: example.location,
* accountTier: "Standard",
* accountKind: "StorageV2",
* accountReplicationType: "LRS",
* });
* const exampleAadDiagnosticSetting = new azure.monitoring.AadDiagnosticSetting("example", {
* name: "setting1",
* storageAccountId: exampleAccount.id,
* enabledLogs: [
* {
* category: "SignInLogs",
* retentionPolicy: {
* enabled: true,
* days: 1,
* },
* },
* {
* category: "AuditLogs",
* retentionPolicy: {
* enabled: true,
* days: 1,
* },
* },
* {
* category: "NonInteractiveUserSignInLogs",
* retentionPolicy: {
* enabled: true,
* days: 1,
* },
* },
* {
* category: "ServicePrincipalSignInLogs",
* retentionPolicy: {
* enabled: true,
* days: 1,
* },
* },
* ],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-rg",
* location="west europe")
* example_account = azure.storage.Account("example",
* name="examplestorageaccount",
* resource_group_name=example.name,
* location=example.location,
* account_tier="Standard",
* account_kind="StorageV2",
* account_replication_type="LRS")
* example_aad_diagnostic_setting = azure.monitoring.AadDiagnosticSetting("example",
* name="setting1",
* storage_account_id=example_account.id,
* enabled_logs=[
* azure.monitoring.AadDiagnosticSettingEnabledLogArgs(
* category="SignInLogs",
* retention_policy=azure.monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs(
* enabled=True,
* days=1,
* ),
* ),
* azure.monitoring.AadDiagnosticSettingEnabledLogArgs(
* category="AuditLogs",
* retention_policy=azure.monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs(
* enabled=True,
* days=1,
* ),
* ),
* azure.monitoring.AadDiagnosticSettingEnabledLogArgs(
* category="NonInteractiveUserSignInLogs",
* retention_policy=azure.monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs(
* enabled=True,
* days=1,
* ),
* ),
* azure.monitoring.AadDiagnosticSettingEnabledLogArgs(
* category="ServicePrincipalSignInLogs",
* retention_policy=azure.monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs(
* enabled=True,
* days=1,
* ),
* ),
* ])
* ```
* ```csharp
* 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-rg",
* Location = "west europe",
* });
* var exampleAccount = new Azure.Storage.Account("example", new()
* {
* Name = "examplestorageaccount",
* ResourceGroupName = example.Name,
* Location = example.Location,
* AccountTier = "Standard",
* AccountKind = "StorageV2",
* AccountReplicationType = "LRS",
* });
* var exampleAadDiagnosticSetting = new Azure.Monitoring.AadDiagnosticSetting("example", new()
* {
* Name = "setting1",
* StorageAccountId = exampleAccount.Id,
* EnabledLogs = new[]
* {
* new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogArgs
* {
* Category = "SignInLogs",
* RetentionPolicy = new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogRetentionPolicyArgs
* {
* Enabled = true,
* Days = 1,
* },
* },
* new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogArgs
* {
* Category = "AuditLogs",
* RetentionPolicy = new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogRetentionPolicyArgs
* {
* Enabled = true,
* Days = 1,
* },
* },
* new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogArgs
* {
* Category = "NonInteractiveUserSignInLogs",
* RetentionPolicy = new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogRetentionPolicyArgs
* {
* Enabled = true,
* Days = 1,
* },
* },
* new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogArgs
* {
* Category = "ServicePrincipalSignInLogs",
* RetentionPolicy = new Azure.Monitoring.Inputs.AadDiagnosticSettingEnabledLogRetentionPolicyArgs
* {
* Enabled = true,
* Days = 1,
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/monitoring"
* "github.com/pulumi/pulumi-azure/sdk/v5/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-rg"),
* Location: pulumi.String("west europe"),
* })
* if err != nil {
* return err
* }
* exampleAccount, err := storage.NewAccount(ctx, "example", &storage.AccountArgs{
* Name: pulumi.String("examplestorageaccount"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* AccountTier: pulumi.String("Standard"),
* AccountKind: pulumi.String("StorageV2"),
* AccountReplicationType: pulumi.String("LRS"),
* })
* if err != nil {
* return err
* }
* _, err = monitoring.NewAadDiagnosticSetting(ctx, "example", &monitoring.AadDiagnosticSettingArgs{
* Name: pulumi.String("setting1"),
* StorageAccountId: exampleAccount.ID(),
* EnabledLogs: monitoring.AadDiagnosticSettingEnabledLogArray{
* &monitoring.AadDiagnosticSettingEnabledLogArgs{
* Category: pulumi.String("SignInLogs"),
* RetentionPolicy: &monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs{
* Enabled: pulumi.Bool(true),
* Days: pulumi.Int(1),
* },
* },
* &monitoring.AadDiagnosticSettingEnabledLogArgs{
* Category: pulumi.String("AuditLogs"),
* RetentionPolicy: &monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs{
* Enabled: pulumi.Bool(true),
* Days: pulumi.Int(1),
* },
* },
* &monitoring.AadDiagnosticSettingEnabledLogArgs{
* Category: pulumi.String("NonInteractiveUserSignInLogs"),
* RetentionPolicy: &monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs{
* Enabled: pulumi.Bool(true),
* Days: pulumi.Int(1),
* },
* },
* &monitoring.AadDiagnosticSettingEnabledLogArgs{
* Category: pulumi.String("ServicePrincipalSignInLogs"),
* RetentionPolicy: &monitoring.AadDiagnosticSettingEnabledLogRetentionPolicyArgs{
* Enabled: pulumi.Bool(true),
* Days: pulumi.Int(1),
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* 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.storage.Account;
* import com.pulumi.azure.storage.AccountArgs;
* import com.pulumi.azure.monitoring.AadDiagnosticSetting;
* import com.pulumi.azure.monitoring.AadDiagnosticSettingArgs;
* import com.pulumi.azure.monitoring.inputs.AadDiagnosticSettingEnabledLogArgs;
* import com.pulumi.azure.monitoring.inputs.AadDiagnosticSettingEnabledLogRetentionPolicyArgs;
* 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-rg")
* .location("west europe")
* .build());
* var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
* .name("examplestorageaccount")
* .resourceGroupName(example.name())
* .location(example.location())
* .accountTier("Standard")
* .accountKind("StorageV2")
* .accountReplicationType("LRS")
* .build());
* var exampleAadDiagnosticSetting = new AadDiagnosticSetting("exampleAadDiagnosticSetting", AadDiagnosticSettingArgs.builder()
* .name("setting1")
* .storageAccountId(exampleAccount.id())
* .enabledLogs(
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("SignInLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build(),
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("AuditLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build(),
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("NonInteractiveUserSignInLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build(),
* AadDiagnosticSettingEnabledLogArgs.builder()
* .category("ServicePrincipalSignInLogs")
* .retentionPolicy(AadDiagnosticSettingEnabledLogRetentionPolicyArgs.builder()
* .enabled(true)
* .days(1)
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-rg
* location: west europe
* exampleAccount:
* type: azure:storage:Account
* name: example
* properties:
* name: examplestorageaccount
* resourceGroupName: ${example.name}
* location: ${example.location}
* accountTier: Standard
* accountKind: StorageV2
* accountReplicationType: LRS
* exampleAadDiagnosticSetting:
* type: azure:monitoring:AadDiagnosticSetting
* name: example
* properties:
* name: setting1
* storageAccountId: ${exampleAccount.id}
* enabledLogs:
* - category: SignInLogs
* retentionPolicy:
* enabled: true
* days: 1
* - category: AuditLogs
* retentionPolicy:
* enabled: true
* days: 1
* - category: NonInteractiveUserSignInLogs
* retentionPolicy:
* enabled: true
* days: 1
* - category: ServicePrincipalSignInLogs
* retentionPolicy:
* enabled: true
* days: 1
* ```
*
* ## Import
* Monitor Azure Active Directory Diagnostic Settings can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:monitoring/aadDiagnosticSetting:AadDiagnosticSetting example /providers/Microsoft.AADIAM/diagnosticSettings/setting1
* ```
* @property enabledLogs One or more `enabled_log` blocks as defined below.
* > **NOTE:** At least one `log` or `enabled_log` block must be specified. At least one type of Log must be enabled.
* @property eventhubAuthorizationRuleId Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
* > **NOTE:** This can be sourced from the `azure.eventhub.EventHubNamespaceAuthorizationRule` resource and is different from a `azure.eventhub.AuthorizationRule` resource.
* @property eventhubName Specifies the name of the Event Hub where Diagnostics Data should be sent. If not specified, the default Event Hub will be used. Changing this forces a new resource to be created.
* @property logAnalyticsWorkspaceId Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
* @property logs One or more `log` blocks as defined below.
* > **NOTE:** `log` is deprecated in favour of the `enabled_log` property and will be removed in version 4.0 of the AzureRM Provider.
* @property name The name which should be used for this Monitor Azure Active Directory Diagnostic Setting. Changing this forces a new Monitor Azure Active Directory Diagnostic Setting to be created.
* @property storageAccountId The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
* > **NOTE:** One of `eventhub_authorization_rule_id`, `log_analytics_workspace_id` and `storage_account_id` must be specified.
*/
public data class AadDiagnosticSettingArgs(
public val enabledLogs: Output>? = null,
public val eventhubAuthorizationRuleId: Output? = null,
public val eventhubName: Output? = null,
public val logAnalyticsWorkspaceId: Output? = null,
@Deprecated(
message = """
`log` has been superseded by `enabled_log` and will be removed in version 4.0 of the AzureRM
Provider.
""",
)
public val logs: Output>? = null,
public val name: Output? = null,
public val storageAccountId: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.azure.monitoring.AadDiagnosticSettingArgs =
com.pulumi.azure.monitoring.AadDiagnosticSettingArgs.builder()
.enabledLogs(
enabledLogs?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.eventhubAuthorizationRuleId(eventhubAuthorizationRuleId?.applyValue({ args0 -> args0 }))
.eventhubName(eventhubName?.applyValue({ args0 -> args0 }))
.logAnalyticsWorkspaceId(logAnalyticsWorkspaceId?.applyValue({ args0 -> args0 }))
.logs(logs?.applyValue({ args0 -> args0.map({ args0 -> args0.let({ args0 -> args0.toJava() }) }) }))
.name(name?.applyValue({ args0 -> args0 }))
.storageAccountId(storageAccountId?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [AadDiagnosticSettingArgs].
*/
@PulumiTagMarker
public class AadDiagnosticSettingArgsBuilder internal constructor() {
private var enabledLogs: Output>? = null
private var eventhubAuthorizationRuleId: Output? = null
private var eventhubName: Output? = null
private var logAnalyticsWorkspaceId: Output? = null
private var logs: Output>? = null
private var name: Output? = null
private var storageAccountId: Output? = null
/**
* @param value One or more `enabled_log` blocks as defined below.
* > **NOTE:** At least one `log` or `enabled_log` block must be specified. At least one type of Log must be enabled.
*/
@JvmName("togcrxbxnfqfmwun")
public suspend fun enabledLogs(`value`: Output>) {
this.enabledLogs = value
}
@JvmName("gixhnvpanrplmgja")
public suspend fun enabledLogs(vararg values: Output) {
this.enabledLogs = Output.all(values.asList())
}
/**
* @param values One or more `enabled_log` blocks as defined below.
* > **NOTE:** At least one `log` or `enabled_log` block must be specified. At least one type of Log must be enabled.
*/
@JvmName("emxenfcmbbieuqit")
public suspend fun enabledLogs(values: List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy