1. Packages
  2. Azure Classic
  3. API Docs
  4. monitoring
  5. DiagnosticSetting

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
azure logo

We recommend using Azure Native.

Viewing docs for Azure v4.42.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    Manages a Diagnostic Setting for an existing Resource.

    Example Usage

    using Pulumi;
    using Azure = Pulumi.Azure;
    
    class MyStack : Stack
    {
        public MyStack()
        {
            var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
            {
                Location = "West Europe",
            });
            var exampleAccount = Azure.Storage.GetAccount.Invoke(new Azure.Storage.GetAccountInvokeArgs
            {
                Name = "examplestoracc",
                ResourceGroupName = exampleResourceGroup.Name,
            });
            var exampleKeyVault = Azure.KeyVault.GetKeyVault.Invoke(new Azure.KeyVault.GetKeyVaultInvokeArgs
            {
                Name = "example-vault",
                ResourceGroupName = exampleResourceGroup.Name,
            });
            var exampleDiagnosticSetting = new Azure.Monitoring.DiagnosticSetting("exampleDiagnosticSetting", new Azure.Monitoring.DiagnosticSettingArgs
            {
                TargetResourceId = exampleKeyVault.Apply(exampleKeyVault => exampleKeyVault.Id),
                StorageAccountId = exampleAccount.Apply(exampleAccount => exampleAccount.Id),
                Logs = 
                {
                    new Azure.Monitoring.Inputs.DiagnosticSettingLogArgs
                    {
                        Category = "AuditEvent",
                        Enabled = false,
                        RetentionPolicy = new Azure.Monitoring.Inputs.DiagnosticSettingLogRetentionPolicyArgs
                        {
                            Enabled = false,
                        },
                    },
                },
                Metrics = 
                {
                    new Azure.Monitoring.Inputs.DiagnosticSettingMetricArgs
                    {
                        Category = "AllMetrics",
                        RetentionPolicy = new Azure.Monitoring.Inputs.DiagnosticSettingMetricRetentionPolicyArgs
                        {
                            Enabled = false,
                        },
                    },
                },
            });
        }
    
    }
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/keyvault"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/monitoring"
    	"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/storage"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleAccount := storage.LookupAccountOutput(ctx, storage.GetAccountOutputArgs{
    			Name:              pulumi.String("examplestoracc"),
    			ResourceGroupName: exampleResourceGroup.Name,
    		}, nil)
    		exampleKeyVault := keyvault.LookupKeyVaultOutput(ctx, keyvault.GetKeyVaultOutputArgs{
    			Name:              pulumi.String("example-vault"),
    			ResourceGroupName: exampleResourceGroup.Name,
    		}, nil)
    		_, err = monitoring.NewDiagnosticSetting(ctx, "exampleDiagnosticSetting", &monitoring.DiagnosticSettingArgs{
    			TargetResourceId: exampleKeyVault.ApplyT(func(exampleKeyVault keyvault.GetKeyVaultResult) (string, error) {
    				return exampleKeyVault.Id, nil
    			}).(pulumi.StringOutput),
    			StorageAccountId: exampleAccount.ApplyT(func(exampleAccount storage.GetAccountResult) (string, error) {
    				return exampleAccount.Id, nil
    			}).(pulumi.StringOutput),
    			Logs: monitoring.DiagnosticSettingLogArray{
    				&monitoring.DiagnosticSettingLogArgs{
    					Category: pulumi.String("AuditEvent"),
    					Enabled:  pulumi.Bool(false),
    					RetentionPolicy: &monitoring.DiagnosticSettingLogRetentionPolicyArgs{
    						Enabled: pulumi.Bool(false),
    					},
    				},
    			},
    			Metrics: monitoring.DiagnosticSettingMetricArray{
    				&monitoring.DiagnosticSettingMetricArgs{
    					Category: pulumi.String("AllMetrics"),
    					RetentionPolicy: &monitoring.DiagnosticSettingMetricRetentionPolicyArgs{
    						Enabled: pulumi.Bool(false),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleAccount = azure.storage.getAccountOutput({
        name: "examplestoracc",
        resourceGroupName: exampleResourceGroup.name,
    });
    const exampleKeyVault = azure.keyvault.getKeyVaultOutput({
        name: "example-vault",
        resourceGroupName: exampleResourceGroup.name,
    });
    const exampleDiagnosticSetting = new azure.monitoring.DiagnosticSetting("exampleDiagnosticSetting", {
        targetResourceId: exampleKeyVault.apply(exampleKeyVault => exampleKeyVault.id),
        storageAccountId: exampleAccount.apply(exampleAccount => exampleAccount.id),
        logs: [{
            category: "AuditEvent",
            enabled: false,
            retentionPolicy: {
                enabled: false,
            },
        }],
        metrics: [{
            category: "AllMetrics",
            retentionPolicy: {
                enabled: false,
            },
        }],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_account = azure.storage.get_account_output(name="examplestoracc",
        resource_group_name=example_resource_group.name)
    example_key_vault = azure.keyvault.get_key_vault_output(name="example-vault",
        resource_group_name=example_resource_group.name)
    example_diagnostic_setting = azure.monitoring.DiagnosticSetting("exampleDiagnosticSetting",
        target_resource_id=example_key_vault.id,
        storage_account_id=example_account.id,
        logs=[azure.monitoring.DiagnosticSettingLogArgs(
            category="AuditEvent",
            enabled=False,
            retention_policy=azure.monitoring.DiagnosticSettingLogRetentionPolicyArgs(
                enabled=False,
            ),
        )],
        metrics=[azure.monitoring.DiagnosticSettingMetricArgs(
            category="AllMetrics",
            retention_policy=azure.monitoring.DiagnosticSettingMetricRetentionPolicyArgs(
                enabled=False,
            ),
        )])
    

    Example coming soon!

    Create DiagnosticSetting Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new DiagnosticSetting(name: string, args: DiagnosticSettingArgs, opts?: CustomResourceOptions);
    @overload
    def DiagnosticSetting(resource_name: str,
                          args: DiagnosticSettingArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def DiagnosticSetting(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          target_resource_id: Optional[str] = None,
                          eventhub_authorization_rule_id: Optional[str] = None,
                          eventhub_name: Optional[str] = None,
                          log_analytics_destination_type: Optional[str] = None,
                          log_analytics_workspace_id: Optional[str] = None,
                          logs: Optional[Sequence[DiagnosticSettingLogArgs]] = None,
                          metrics: Optional[Sequence[DiagnosticSettingMetricArgs]] = None,
                          name: Optional[str] = None,
                          storage_account_id: Optional[str] = None)
    func NewDiagnosticSetting(ctx *Context, name string, args DiagnosticSettingArgs, opts ...ResourceOption) (*DiagnosticSetting, error)
    public DiagnosticSetting(string name, DiagnosticSettingArgs args, CustomResourceOptions? opts = null)
    public DiagnosticSetting(String name, DiagnosticSettingArgs args)
    public DiagnosticSetting(String name, DiagnosticSettingArgs args, CustomResourceOptions options)
    
    type: azure:monitoring:DiagnosticSetting
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args DiagnosticSettingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args DiagnosticSettingArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args DiagnosticSettingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DiagnosticSettingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DiagnosticSettingArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var diagnosticSettingResource = new Azure.Monitoring.DiagnosticSetting("diagnosticSettingResource", new()
    {
        TargetResourceId = "string",
        EventhubAuthorizationRuleId = "string",
        EventhubName = "string",
        LogAnalyticsDestinationType = "string",
        LogAnalyticsWorkspaceId = "string",
        Logs = new[]
        {
            new Azure.Monitoring.Inputs.DiagnosticSettingLogArgs
            {
                Category = "string",
                Enabled = false,
                RetentionPolicy = new Azure.Monitoring.Inputs.DiagnosticSettingLogRetentionPolicyArgs
                {
                    Enabled = false,
                    Days = 0,
                },
            },
        },
        Metrics = new[]
        {
            new Azure.Monitoring.Inputs.DiagnosticSettingMetricArgs
            {
                Category = "string",
                Enabled = false,
                RetentionPolicy = new Azure.Monitoring.Inputs.DiagnosticSettingMetricRetentionPolicyArgs
                {
                    Enabled = false,
                    Days = 0,
                },
            },
        },
        Name = "string",
        StorageAccountId = "string",
    });
    
    example, err := monitoring.NewDiagnosticSetting(ctx, "diagnosticSettingResource", &monitoring.DiagnosticSettingArgs{
    	TargetResourceId:            pulumi.String("string"),
    	EventhubAuthorizationRuleId: pulumi.String("string"),
    	EventhubName:                pulumi.String("string"),
    	LogAnalyticsDestinationType: pulumi.String("string"),
    	LogAnalyticsWorkspaceId:     pulumi.String("string"),
    	Logs: monitoring.DiagnosticSettingLogArray{
    		&monitoring.DiagnosticSettingLogArgs{
    			Category: pulumi.String("string"),
    			Enabled:  pulumi.Bool(false),
    			RetentionPolicy: &monitoring.DiagnosticSettingLogRetentionPolicyArgs{
    				Enabled: pulumi.Bool(false),
    				Days:    pulumi.Int(0),
    			},
    		},
    	},
    	Metrics: monitoring.DiagnosticSettingMetricArray{
    		&monitoring.DiagnosticSettingMetricArgs{
    			Category: pulumi.String("string"),
    			Enabled:  pulumi.Bool(false),
    			RetentionPolicy: &monitoring.DiagnosticSettingMetricRetentionPolicyArgs{
    				Enabled: pulumi.Bool(false),
    				Days:    pulumi.Int(0),
    			},
    		},
    	},
    	Name:             pulumi.String("string"),
    	StorageAccountId: pulumi.String("string"),
    })
    
    var diagnosticSettingResource = new DiagnosticSetting("diagnosticSettingResource", DiagnosticSettingArgs.builder()
        .targetResourceId("string")
        .eventhubAuthorizationRuleId("string")
        .eventhubName("string")
        .logAnalyticsDestinationType("string")
        .logAnalyticsWorkspaceId("string")
        .logs(DiagnosticSettingLogArgs.builder()
            .category("string")
            .enabled(false)
            .retentionPolicy(DiagnosticSettingLogRetentionPolicyArgs.builder()
                .enabled(false)
                .days(0)
                .build())
            .build())
        .metrics(DiagnosticSettingMetricArgs.builder()
            .category("string")
            .enabled(false)
            .retentionPolicy(DiagnosticSettingMetricRetentionPolicyArgs.builder()
                .enabled(false)
                .days(0)
                .build())
            .build())
        .name("string")
        .storageAccountId("string")
        .build());
    
    diagnostic_setting_resource = azure.monitoring.DiagnosticSetting("diagnosticSettingResource",
        target_resource_id="string",
        eventhub_authorization_rule_id="string",
        eventhub_name="string",
        log_analytics_destination_type="string",
        log_analytics_workspace_id="string",
        logs=[{
            "category": "string",
            "enabled": False,
            "retention_policy": {
                "enabled": False,
                "days": 0,
            },
        }],
        metrics=[{
            "category": "string",
            "enabled": False,
            "retention_policy": {
                "enabled": False,
                "days": 0,
            },
        }],
        name="string",
        storage_account_id="string")
    
    const diagnosticSettingResource = new azure.monitoring.DiagnosticSetting("diagnosticSettingResource", {
        targetResourceId: "string",
        eventhubAuthorizationRuleId: "string",
        eventhubName: "string",
        logAnalyticsDestinationType: "string",
        logAnalyticsWorkspaceId: "string",
        logs: [{
            category: "string",
            enabled: false,
            retentionPolicy: {
                enabled: false,
                days: 0,
            },
        }],
        metrics: [{
            category: "string",
            enabled: false,
            retentionPolicy: {
                enabled: false,
                days: 0,
            },
        }],
        name: "string",
        storageAccountId: "string",
    });
    
    type: azure:monitoring:DiagnosticSetting
    properties:
        eventhubAuthorizationRuleId: string
        eventhubName: string
        logAnalyticsDestinationType: string
        logAnalyticsWorkspaceId: string
        logs:
            - category: string
              enabled: false
              retentionPolicy:
                days: 0
                enabled: false
        metrics:
            - category: string
              enabled: false
              retentionPolicy:
                days: 0
                enabled: false
        name: string
        storageAccountId: string
        targetResourceId: string
    

    DiagnosticSetting Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The DiagnosticSetting resource accepts the following input properties:

    TargetResourceId string
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    EventhubAuthorizationRuleId string
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    EventhubName string
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    LogAnalyticsDestinationType string
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    LogAnalyticsWorkspaceId string
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    Logs List<DiagnosticSettingLog>
    One or more log blocks as defined below.
    Metrics List<DiagnosticSettingMetric>
    One or more metric blocks as defined below.
    Name string
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    StorageAccountId string
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    TargetResourceId string
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    EventhubAuthorizationRuleId string
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    EventhubName string
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    LogAnalyticsDestinationType string
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    LogAnalyticsWorkspaceId string
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    Logs []DiagnosticSettingLogArgs
    One or more log blocks as defined below.
    Metrics []DiagnosticSettingMetricArgs
    One or more metric blocks as defined below.
    Name string
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    StorageAccountId string
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    targetResourceId String
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhubAuthorizationRuleId String
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhubName String
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    logAnalyticsDestinationType String
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    logAnalyticsWorkspaceId String
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs List<DiagnosticSettingLog>
    One or more log blocks as defined below.
    metrics List<DiagnosticSettingMetric>
    One or more metric blocks as defined below.
    name String
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storageAccountId String
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    targetResourceId string
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhubAuthorizationRuleId string
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhubName string
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    logAnalyticsDestinationType string
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    logAnalyticsWorkspaceId string
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs DiagnosticSettingLog[]
    One or more log blocks as defined below.
    metrics DiagnosticSettingMetric[]
    One or more metric blocks as defined below.
    name string
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storageAccountId string
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    target_resource_id str
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhub_authorization_rule_id str
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhub_name str
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    log_analytics_destination_type str
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    log_analytics_workspace_id str
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs Sequence[DiagnosticSettingLogArgs]
    One or more log blocks as defined below.
    metrics Sequence[DiagnosticSettingMetricArgs]
    One or more metric blocks as defined below.
    name str
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storage_account_id str
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    targetResourceId String
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhubAuthorizationRuleId String
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhubName String
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    logAnalyticsDestinationType String
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    logAnalyticsWorkspaceId String
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs List<Property Map>
    One or more log blocks as defined below.
    metrics List<Property Map>
    One or more metric blocks as defined below.
    name String
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storageAccountId String
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the DiagnosticSetting resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing DiagnosticSetting Resource

    Get an existing DiagnosticSetting resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: DiagnosticSettingState, opts?: CustomResourceOptions): DiagnosticSetting
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            eventhub_authorization_rule_id: Optional[str] = None,
            eventhub_name: Optional[str] = None,
            log_analytics_destination_type: Optional[str] = None,
            log_analytics_workspace_id: Optional[str] = None,
            logs: Optional[Sequence[DiagnosticSettingLogArgs]] = None,
            metrics: Optional[Sequence[DiagnosticSettingMetricArgs]] = None,
            name: Optional[str] = None,
            storage_account_id: Optional[str] = None,
            target_resource_id: Optional[str] = None) -> DiagnosticSetting
    func GetDiagnosticSetting(ctx *Context, name string, id IDInput, state *DiagnosticSettingState, opts ...ResourceOption) (*DiagnosticSetting, error)
    public static DiagnosticSetting Get(string name, Input<string> id, DiagnosticSettingState? state, CustomResourceOptions? opts = null)
    public static DiagnosticSetting get(String name, Output<String> id, DiagnosticSettingState state, CustomResourceOptions options)
    resources:  _:    type: azure:monitoring:DiagnosticSetting    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    EventhubAuthorizationRuleId string
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    EventhubName string
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    LogAnalyticsDestinationType string
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    LogAnalyticsWorkspaceId string
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    Logs List<DiagnosticSettingLog>
    One or more log blocks as defined below.
    Metrics List<DiagnosticSettingMetric>
    One or more metric blocks as defined below.
    Name string
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    StorageAccountId string
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    TargetResourceId string
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    EventhubAuthorizationRuleId string
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    EventhubName string
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    LogAnalyticsDestinationType string
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    LogAnalyticsWorkspaceId string
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    Logs []DiagnosticSettingLogArgs
    One or more log blocks as defined below.
    Metrics []DiagnosticSettingMetricArgs
    One or more metric blocks as defined below.
    Name string
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    StorageAccountId string
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    TargetResourceId string
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhubAuthorizationRuleId String
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhubName String
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    logAnalyticsDestinationType String
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    logAnalyticsWorkspaceId String
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs List<DiagnosticSettingLog>
    One or more log blocks as defined below.
    metrics List<DiagnosticSettingMetric>
    One or more metric blocks as defined below.
    name String
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storageAccountId String
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    targetResourceId String
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhubAuthorizationRuleId string
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhubName string
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    logAnalyticsDestinationType string
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    logAnalyticsWorkspaceId string
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs DiagnosticSettingLog[]
    One or more log blocks as defined below.
    metrics DiagnosticSettingMetric[]
    One or more metric blocks as defined below.
    name string
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storageAccountId string
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    targetResourceId string
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhub_authorization_rule_id str
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhub_name str
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    log_analytics_destination_type str
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    log_analytics_workspace_id str
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs Sequence[DiagnosticSettingLogArgs]
    One or more log blocks as defined below.
    metrics Sequence[DiagnosticSettingMetricArgs]
    One or more metric blocks as defined below.
    name str
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storage_account_id str
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    target_resource_id str
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.
    eventhubAuthorizationRuleId String
    Specifies the ID of an Event Hub Namespace Authorization Rule used to send Diagnostics Data. Changing this forces a new resource to be created.
    eventhubName String
    Specifies the name of the Event Hub where Diagnostics Data should be sent. Changing this forces a new resource to be created.
    logAnalyticsDestinationType String
    When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table.
    logAnalyticsWorkspaceId String
    Specifies the ID of a Log Analytics Workspace where Diagnostics Data should be sent.
    logs List<Property Map>
    One or more log blocks as defined below.
    metrics List<Property Map>
    One or more metric blocks as defined below.
    name String
    Specifies the name of the Diagnostic Setting. Changing this forces a new resource to be created.
    storageAccountId String
    The ID of the Storage Account where logs should be sent. Changing this forces a new resource to be created.
    targetResourceId String
    The ID of an existing Resource on which to configure Diagnostic Settings. Changing this forces a new resource to be created.

    Supporting Types

    DiagnosticSettingLog, DiagnosticSettingLogArgs

    Category string
    The name of a Diagnostic Log Category for this Resource.
    Enabled bool
    Is this Diagnostic Log enabled? Defaults to true.
    RetentionPolicy DiagnosticSettingLogRetentionPolicy
    A retention_policy block as defined below.
    Category string
    The name of a Diagnostic Log Category for this Resource.
    Enabled bool
    Is this Diagnostic Log enabled? Defaults to true.
    RetentionPolicy DiagnosticSettingLogRetentionPolicy
    A retention_policy block as defined below.
    category String
    The name of a Diagnostic Log Category for this Resource.
    enabled Boolean
    Is this Diagnostic Log enabled? Defaults to true.
    retentionPolicy DiagnosticSettingLogRetentionPolicy
    A retention_policy block as defined below.
    category string
    The name of a Diagnostic Log Category for this Resource.
    enabled boolean
    Is this Diagnostic Log enabled? Defaults to true.
    retentionPolicy DiagnosticSettingLogRetentionPolicy
    A retention_policy block as defined below.
    category str
    The name of a Diagnostic Log Category for this Resource.
    enabled bool
    Is this Diagnostic Log enabled? Defaults to true.
    retention_policy DiagnosticSettingLogRetentionPolicy
    A retention_policy block as defined below.
    category String
    The name of a Diagnostic Log Category for this Resource.
    enabled Boolean
    Is this Diagnostic Log enabled? Defaults to true.
    retentionPolicy Property Map
    A retention_policy block as defined below.

    DiagnosticSettingLogRetentionPolicy, DiagnosticSettingLogRetentionPolicyArgs

    Enabled bool
    Is this Retention Policy enabled?
    Days int
    The number of days for which this Retention Policy should apply.
    Enabled bool
    Is this Retention Policy enabled?
    Days int
    The number of days for which this Retention Policy should apply.
    enabled Boolean
    Is this Retention Policy enabled?
    days Integer
    The number of days for which this Retention Policy should apply.
    enabled boolean
    Is this Retention Policy enabled?
    days number
    The number of days for which this Retention Policy should apply.
    enabled bool
    Is this Retention Policy enabled?
    days int
    The number of days for which this Retention Policy should apply.
    enabled Boolean
    Is this Retention Policy enabled?
    days Number
    The number of days for which this Retention Policy should apply.

    DiagnosticSettingMetric, DiagnosticSettingMetricArgs

    Category string
    The name of a Diagnostic Metric Category for this Resource.
    Enabled bool
    Is this Diagnostic Metric enabled? Defaults to true.
    RetentionPolicy DiagnosticSettingMetricRetentionPolicy
    A retention_policy block as defined below.
    Category string
    The name of a Diagnostic Metric Category for this Resource.
    Enabled bool
    Is this Diagnostic Metric enabled? Defaults to true.
    RetentionPolicy DiagnosticSettingMetricRetentionPolicy
    A retention_policy block as defined below.
    category String
    The name of a Diagnostic Metric Category for this Resource.
    enabled Boolean
    Is this Diagnostic Metric enabled? Defaults to true.
    retentionPolicy DiagnosticSettingMetricRetentionPolicy
    A retention_policy block as defined below.
    category string
    The name of a Diagnostic Metric Category for this Resource.
    enabled boolean
    Is this Diagnostic Metric enabled? Defaults to true.
    retentionPolicy DiagnosticSettingMetricRetentionPolicy
    A retention_policy block as defined below.
    category str
    The name of a Diagnostic Metric Category for this Resource.
    enabled bool
    Is this Diagnostic Metric enabled? Defaults to true.
    retention_policy DiagnosticSettingMetricRetentionPolicy
    A retention_policy block as defined below.
    category String
    The name of a Diagnostic Metric Category for this Resource.
    enabled Boolean
    Is this Diagnostic Metric enabled? Defaults to true.
    retentionPolicy Property Map
    A retention_policy block as defined below.

    DiagnosticSettingMetricRetentionPolicy, DiagnosticSettingMetricRetentionPolicyArgs

    Enabled bool
    Is this Retention Policy enabled?
    Days int
    The number of days for which this Retention Policy should apply.
    Enabled bool
    Is this Retention Policy enabled?
    Days int
    The number of days for which this Retention Policy should apply.
    enabled Boolean
    Is this Retention Policy enabled?
    days Integer
    The number of days for which this Retention Policy should apply.
    enabled boolean
    Is this Retention Policy enabled?
    days number
    The number of days for which this Retention Policy should apply.
    enabled bool
    Is this Retention Policy enabled?
    days int
    The number of days for which this Retention Policy should apply.
    enabled Boolean
    Is this Retention Policy enabled?
    days Number
    The number of days for which this Retention Policy should apply.

    Import

    Diagnostic Settings can be imported using the resource id, e.g.

     $ pulumi import azure:monitoring/diagnosticSetting:DiagnosticSetting example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.KeyVault/vaults/vault1|logMonitoring1"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Viewing docs for Azure v4.42.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.