Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Azure Native

v1.42.0 published on Monday, Oct 25, 2021 by Pulumi

DiagnosticSetting

The diagnostic setting resource. API Version: 2017-05-01-preview.

Example Usage

Creates or Updates the diagnostic setting

using Pulumi;
using AzureNative = Pulumi.AzureNative;

class MyStack : Stack
{
    public MyStack()
    {
        var diagnosticSetting = new AzureNative.Insights.DiagnosticSetting("diagnosticSetting", new AzureNative.Insights.DiagnosticSettingArgs
        {
            EventHubAuthorizationRuleId = "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
            EventHubName = "myeventhub",
            LogAnalyticsDestinationType = "Dedicated",
            Logs = 
            {
                new AzureNative.Insights.Inputs.LogSettingsArgs
                {
                    Category = "WorkflowRuntime",
                    Enabled = true,
                    RetentionPolicy = new AzureNative.Insights.Inputs.RetentionPolicyArgs
                    {
                        Days = 0,
                        Enabled = false,
                    },
                },
            },
            Metrics = 
            {
                new AzureNative.Insights.Inputs.MetricSettingsArgs
                {
                    Category = "WorkflowMetrics",
                    Enabled = true,
                    RetentionPolicy = new AzureNative.Insights.Inputs.RetentionPolicyArgs
                    {
                        Days = 0,
                        Enabled = false,
                    },
                },
            },
            Name = "mysetting",
            ResourceUri = "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6",
            StorageAccountId = "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
            WorkspaceId = "",
        });
    }

}

package main

import (
	insights "github.com/pulumi/pulumi-azure-native/sdk/go/azure/insights"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := insights.NewDiagnosticSetting(ctx, "diagnosticSetting", &insights.DiagnosticSettingArgs{
			EventHubAuthorizationRuleId: pulumi.String("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule"),
			EventHubName:                pulumi.String("myeventhub"),
			LogAnalyticsDestinationType: pulumi.String("Dedicated"),
			Logs: []insights.LogSettingsArgs{
				&insights.LogSettingsArgs{
					Category: pulumi.String("WorkflowRuntime"),
					Enabled:  pulumi.Bool(true),
					RetentionPolicy: &insights.RetentionPolicyArgs{
						Days:    pulumi.Int(0),
						Enabled: pulumi.Bool(false),
					},
				},
			},
			Metrics: []insights.MetricSettingsArgs{
				&insights.MetricSettingsArgs{
					Category: pulumi.String("WorkflowMetrics"),
					Enabled:  pulumi.Bool(true),
					RetentionPolicy: &insights.RetentionPolicyArgs{
						Days:    pulumi.Int(0),
						Enabled: pulumi.Bool(false),
					},
				},
			},
			Name:             pulumi.String("mysetting"),
			ResourceUri:      pulumi.String("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6"),
			StorageAccountId: pulumi.String("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"),
			WorkspaceId:      pulumi.String(""),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

import pulumi
import pulumi_azure_native as azure_native

diagnostic_setting = azure_native.insights.DiagnosticSetting("diagnosticSetting",
    event_hub_authorization_rule_id="/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
    event_hub_name="myeventhub",
    log_analytics_destination_type="Dedicated",
    logs=[azure_native.insights.LogSettingsArgs(
        category="WorkflowRuntime",
        enabled=True,
        retention_policy=azure_native.insights.RetentionPolicyArgs(
            days=0,
            enabled=False,
        ),
    )],
    metrics=[azure_native.insights.MetricSettingsArgs(
        category="WorkflowMetrics",
        enabled=True,
        retention_policy=azure_native.insights.RetentionPolicyArgs(
            days=0,
            enabled=False,
        ),
    )],
    name="mysetting",
    resource_uri="subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6",
    storage_account_id="/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
    workspace_id="")

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const diagnosticSetting = new azure_native.insights.DiagnosticSetting("diagnosticSetting", {
    eventHubAuthorizationRuleId: "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
    eventHubName: "myeventhub",
    logAnalyticsDestinationType: "Dedicated",
    logs: [{
        category: "WorkflowRuntime",
        enabled: true,
        retentionPolicy: {
            days: 0,
            enabled: false,
        },
    }],
    metrics: [{
        category: "WorkflowMetrics",
        enabled: true,
        retentionPolicy: {
            days: 0,
            enabled: false,
        },
    }],
    name: "mysetting",
    resourceUri: "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6",
    storageAccountId: "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
    workspaceId: "",
});

Create a DiagnosticSetting Resource

new DiagnosticSetting(name: string, args: DiagnosticSettingArgs, opts?: CustomResourceOptions);
@overload
def DiagnosticSetting(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      event_hub_authorization_rule_id: Optional[str] = None,
                      event_hub_name: Optional[str] = None,
                      log_analytics_destination_type: Optional[str] = None,
                      logs: Optional[Sequence[LogSettingsArgs]] = None,
                      metrics: Optional[Sequence[MetricSettingsArgs]] = None,
                      name: Optional[str] = None,
                      resource_uri: Optional[str] = None,
                      service_bus_rule_id: Optional[str] = None,
                      storage_account_id: Optional[str] = None,
                      workspace_id: Optional[str] = None)
@overload
def DiagnosticSetting(resource_name: str,
                      args: DiagnosticSettingArgs,
                      opts: Optional[ResourceOptions] = None)
func NewDiagnosticSetting(ctx *Context, name string, args DiagnosticSettingArgs, opts ...ResourceOption) (*DiagnosticSetting, error)
public DiagnosticSetting(string name, DiagnosticSettingArgs args, CustomResourceOptions? opts = null)
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.

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

The DiagnosticSetting resource accepts the following input properties:

ResourceUri string
The identifier of the resource.
EventHubAuthorizationRuleId string
The resource Id for the event hub authorization rule.
EventHubName string
The name of the event hub. If none is specified, the default event hub will be selected.
LogAnalyticsDestinationType string
A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.)
Logs List<Pulumi.AzureNative.Insights.Inputs.LogSettingsArgs>
The list of logs settings.
Metrics List<Pulumi.AzureNative.Insights.Inputs.MetricSettingsArgs>
The list of metric settings.
Name string
The name of the diagnostic setting.
ServiceBusRuleId string
The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
StorageAccountId string
The resource ID of the storage account to which you would like to send Diagnostic Logs.
WorkspaceId string
The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2
ResourceUri string
The identifier of the resource.
EventHubAuthorizationRuleId string
The resource Id for the event hub authorization rule.
EventHubName string
The name of the event hub. If none is specified, the default event hub will be selected.
LogAnalyticsDestinationType string
A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.)
Logs []LogSettingsArgs
The list of logs settings.
Metrics []MetricSettingsArgs
The list of metric settings.
Name string
The name of the diagnostic setting.
ServiceBusRuleId string
The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
StorageAccountId string
The resource ID of the storage account to which you would like to send Diagnostic Logs.
WorkspaceId string
The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2
resourceUri string
The identifier of the resource.
eventHubAuthorizationRuleId string
The resource Id for the event hub authorization rule.
eventHubName string
The name of the event hub. If none is specified, the default event hub will be selected.
logAnalyticsDestinationType string
A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.)
logs LogSettingsArgs[]
The list of logs settings.
metrics MetricSettingsArgs[]
The list of metric settings.
name string
The name of the diagnostic setting.
serviceBusRuleId string
The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
storageAccountId string
The resource ID of the storage account to which you would like to send Diagnostic Logs.
workspaceId string
The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2
resource_uri str
The identifier of the resource.
event_hub_authorization_rule_id str
The resource Id for the event hub authorization rule.
event_hub_name str
The name of the event hub. If none is specified, the default event hub will be selected.
log_analytics_destination_type str
A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type constructed as follows: _. Possible values are: Dedicated and null (null is default.)
logs Sequence[LogSettingsArgs]
The list of logs settings.
metrics Sequence[MetricSettingsArgs]
The list of metric settings.
name str
The name of the diagnostic setting.
service_bus_rule_id str
The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
storage_account_id str
The resource ID of the storage account to which you would like to send Diagnostic Logs.
workspace_id str
The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2

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.
Type string
Azure resource type
Id string
The provider-assigned unique ID for this managed resource.
Type string
Azure resource type
id string
The provider-assigned unique ID for this managed resource.
type string
Azure resource type
id str
The provider-assigned unique ID for this managed resource.
type str
Azure resource type

Supporting Types

LogSettings

Enabled bool
a value indicating whether this log is enabled.
Category string
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy Pulumi.AzureNative.Insights.Inputs.RetentionPolicy
the retention policy for this log.
Enabled bool
a value indicating whether this log is enabled.
Category string
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy RetentionPolicy
the retention policy for this log.
enabled boolean
a value indicating whether this log is enabled.
category string
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
retentionPolicy RetentionPolicy
the retention policy for this log.
enabled bool
a value indicating whether this log is enabled.
category str
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
retention_policy RetentionPolicy
the retention policy for this log.

LogSettingsResponse

Enabled bool
a value indicating whether this log is enabled.
Category string
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy Pulumi.AzureNative.Insights.Inputs.RetentionPolicyResponse
the retention policy for this log.
Enabled bool
a value indicating whether this log is enabled.
Category string
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy RetentionPolicyResponse
the retention policy for this log.
enabled boolean
a value indicating whether this log is enabled.
category string
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
retentionPolicy RetentionPolicyResponse
the retention policy for this log.
enabled bool
a value indicating whether this log is enabled.
category str
Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.
retention_policy RetentionPolicyResponse
the retention policy for this log.

MetricSettings

Enabled bool
a value indicating whether this category is enabled.
Category string
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy Pulumi.AzureNative.Insights.Inputs.RetentionPolicy
the retention policy for this category.
TimeGrain string
the timegrain of the metric in ISO8601 format.
Enabled bool
a value indicating whether this category is enabled.
Category string
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy RetentionPolicy
the retention policy for this category.
TimeGrain string
the timegrain of the metric in ISO8601 format.
enabled boolean
a value indicating whether this category is enabled.
category string
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
retentionPolicy RetentionPolicy
the retention policy for this category.
timeGrain string
the timegrain of the metric in ISO8601 format.
enabled bool
a value indicating whether this category is enabled.
category str
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
retention_policy RetentionPolicy
the retention policy for this category.
time_grain str
the timegrain of the metric in ISO8601 format.

MetricSettingsResponse

Enabled bool
a value indicating whether this category is enabled.
Category string
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy Pulumi.AzureNative.Insights.Inputs.RetentionPolicyResponse
the retention policy for this category.
TimeGrain string
the timegrain of the metric in ISO8601 format.
Enabled bool
a value indicating whether this category is enabled.
Category string
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
RetentionPolicy RetentionPolicyResponse
the retention policy for this category.
TimeGrain string
the timegrain of the metric in ISO8601 format.
enabled boolean
a value indicating whether this category is enabled.
category string
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
retentionPolicy RetentionPolicyResponse
the retention policy for this category.
timeGrain string
the timegrain of the metric in ISO8601 format.
enabled bool
a value indicating whether this category is enabled.
category str
Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric categories for a resource, first perform a GET diagnostic settings operation.
retention_policy RetentionPolicyResponse
the retention policy for this category.
time_grain str
the timegrain of the metric in ISO8601 format.

RetentionPolicy

Days int
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
Enabled bool
a value indicating whether the retention policy is enabled.
Days int
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
Enabled bool
a value indicating whether the retention policy is enabled.
days number
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
enabled boolean
a value indicating whether the retention policy is enabled.
days int
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
enabled bool
a value indicating whether the retention policy is enabled.

RetentionPolicyResponse

Days int
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
Enabled bool
a value indicating whether the retention policy is enabled.
Days int
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
Enabled bool
a value indicating whether the retention policy is enabled.
days number
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
enabled boolean
a value indicating whether the retention policy is enabled.
days int
the number of days for the retention in days. A value of 0 will retain the events indefinitely.
enabled bool
a value indicating whether the retention policy is enabled.

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:insights:DiagnosticSetting mysetting /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting 

Package Details

Repository
https://github.com/pulumi/pulumi-azure-native
License
Apache-2.0