azure-native.aadiam.DiagnosticSetting
Explore with Pulumi AI
The diagnostic setting resource. Azure REST API version: 2017-04-01. Prior API version in Azure Native 1.x: 2017-04-01.
Other available API versions: 2017-04-01-preview.
Example Usage
BatchAccountDelete
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var diagnosticSetting = new AzureNative.AadIam.DiagnosticSetting("diagnosticSetting", new()
{
EventHubAuthorizationRuleId = "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
EventHubName = "myeventhub",
Logs = new[]
{
new AzureNative.AadIam.Inputs.LogSettingsArgs
{
Category = AzureNative.AadIam.Category.AuditLogs,
Enabled = true,
RetentionPolicy = new AzureNative.AadIam.Inputs.RetentionPolicyArgs
{
Days = 0,
Enabled = false,
},
},
},
Name = "mysetting",
StorageAccountId = "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
WorkspaceId = "",
});
});
package main
import (
aadiam "github.com/pulumi/pulumi-azure-native-sdk/aadiam/v2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := aadiam.NewDiagnosticSetting(ctx, "diagnosticSetting", &aadiam.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"),
Logs: aadiam.LogSettingsArray{
&aadiam.LogSettingsArgs{
Category: pulumi.String(aadiam.CategoryAuditLogs),
Enabled: pulumi.Bool(true),
RetentionPolicy: &aadiam.RetentionPolicyArgs{
Days: pulumi.Int(0),
Enabled: pulumi.Bool(false),
},
},
},
Name: pulumi.String("mysetting"),
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
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.aadiam.DiagnosticSetting;
import com.pulumi.azurenative.aadiam.DiagnosticSettingArgs;
import com.pulumi.azurenative.aadiam.inputs.LogSettingsArgs;
import com.pulumi.azurenative.aadiam.inputs.RetentionPolicyArgs;
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 diagnosticSetting = new DiagnosticSetting("diagnosticSetting", DiagnosticSettingArgs.builder()
.eventHubAuthorizationRuleId("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule")
.eventHubName("myeventhub")
.logs(LogSettingsArgs.builder()
.category("AuditLogs")
.enabled(true)
.retentionPolicy(RetentionPolicyArgs.builder()
.days(0)
.enabled(false)
.build())
.build())
.name("mysetting")
.storageAccountId("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1")
.workspaceId("")
.build());
}
}
import pulumi
import pulumi_azure_native as azure_native
diagnostic_setting = azure_native.aadiam.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",
logs=[{
"category": azure_native.aadiam.Category.AUDIT_LOGS,
"enabled": True,
"retention_policy": {
"days": 0,
"enabled": False,
},
}],
name="mysetting",
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.aadiam.DiagnosticSetting("diagnosticSetting", {
eventHubAuthorizationRuleId: "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
eventHubName: "myeventhub",
logs: [{
category: azure_native.aadiam.Category.AuditLogs,
enabled: true,
retentionPolicy: {
days: 0,
enabled: false,
},
}],
name: "mysetting",
storageAccountId: "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1",
workspaceId: "",
});
resources:
diagnosticSetting:
type: azure-native:aadiam:DiagnosticSetting
properties:
eventHubAuthorizationRuleId: /subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
eventHubName: myeventhub
logs:
- category: AuditLogs
enabled: true
retentionPolicy:
days: 0
enabled: false
name: mysetting
storageAccountId: /subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1
workspaceId:
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: Optional[DiagnosticSettingArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def DiagnosticSetting(resource_name: str,
opts: Optional[ResourceOptions] = None,
event_hub_authorization_rule_id: Optional[str] = None,
event_hub_name: Optional[str] = None,
logs: Optional[Sequence[LogSettingsArgs]] = None,
name: Optional[str] = None,
service_bus_rule_id: Optional[str] = None,
storage_account_id: Optional[str] = None,
workspace_id: Optional[str] = None)
func NewDiagnosticSetting(ctx *Context, name string, args *DiagnosticSettingArgs, opts ...ResourceOption) (*DiagnosticSetting, error)
public DiagnosticSetting(string name, DiagnosticSettingArgs? args = null, CustomResourceOptions? opts = null)
public DiagnosticSetting(String name, DiagnosticSettingArgs args)
public DiagnosticSetting(String name, DiagnosticSettingArgs args, CustomResourceOptions options)
type: azure-native:aadiam: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 AzureNative.AadIam.DiagnosticSetting("diagnosticSettingResource", new()
{
EventHubAuthorizationRuleId = "string",
EventHubName = "string",
Logs = new[]
{
new AzureNative.AadIam.Inputs.LogSettingsArgs
{
Enabled = false,
Category = "string",
RetentionPolicy = new AzureNative.AadIam.Inputs.RetentionPolicyArgs
{
Days = 0,
Enabled = false,
},
},
},
Name = "string",
ServiceBusRuleId = "string",
StorageAccountId = "string",
WorkspaceId = "string",
});
example, err := aadiam.NewDiagnosticSetting(ctx, "diagnosticSettingResource", &aadiam.DiagnosticSettingArgs{
EventHubAuthorizationRuleId: pulumi.String("string"),
EventHubName: pulumi.String("string"),
Logs: aadiam.LogSettingsArray{
&aadiam.LogSettingsArgs{
Enabled: pulumi.Bool(false),
Category: pulumi.String("string"),
RetentionPolicy: &aadiam.RetentionPolicyArgs{
Days: pulumi.Int(0),
Enabled: pulumi.Bool(false),
},
},
},
Name: pulumi.String("string"),
ServiceBusRuleId: pulumi.String("string"),
StorageAccountId: pulumi.String("string"),
WorkspaceId: pulumi.String("string"),
})
var diagnosticSettingResource = new DiagnosticSetting("diagnosticSettingResource", DiagnosticSettingArgs.builder()
.eventHubAuthorizationRuleId("string")
.eventHubName("string")
.logs(LogSettingsArgs.builder()
.enabled(false)
.category("string")
.retentionPolicy(RetentionPolicyArgs.builder()
.days(0)
.enabled(false)
.build())
.build())
.name("string")
.serviceBusRuleId("string")
.storageAccountId("string")
.workspaceId("string")
.build());
diagnostic_setting_resource = azure_native.aadiam.DiagnosticSetting("diagnosticSettingResource",
event_hub_authorization_rule_id="string",
event_hub_name="string",
logs=[{
"enabled": False,
"category": "string",
"retentionPolicy": {
"days": 0,
"enabled": False,
},
}],
name="string",
service_bus_rule_id="string",
storage_account_id="string",
workspace_id="string")
const diagnosticSettingResource = new azure_native.aadiam.DiagnosticSetting("diagnosticSettingResource", {
eventHubAuthorizationRuleId: "string",
eventHubName: "string",
logs: [{
enabled: false,
category: "string",
retentionPolicy: {
days: 0,
enabled: false,
},
}],
name: "string",
serviceBusRuleId: "string",
storageAccountId: "string",
workspaceId: "string",
});
type: azure-native:aadiam:DiagnosticSetting
properties:
eventHubAuthorizationRuleId: string
eventHubName: string
logs:
- category: string
enabled: false
retentionPolicy:
days: 0
enabled: false
name: string
serviceBusRuleId: string
storageAccountId: string
workspaceId: 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
The DiagnosticSetting resource accepts the following input properties:
- string
- The resource Id for the event hub authorization rule.
- Event
Hub stringName - The name of the event hub. If none is specified, the default event hub will be selected.
- Logs
List<Pulumi.
Azure Native. Aad Iam. Inputs. Log Settings> - The list of logs settings.
- Name string
- The name of the diagnostic setting.
- Service
Bus stringRule Id - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
- Storage
Account stringId - The resource ID of the storage account to which you would like to send Diagnostic Logs.
- Workspace
Id string - The workspace ID (resource ID of a Log Analytics workspace) for a 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
- string
- The resource Id for the event hub authorization rule.
- Event
Hub stringName - The name of the event hub. If none is specified, the default event hub will be selected.
- Logs
[]Log
Settings Args - The list of logs settings.
- Name string
- The name of the diagnostic setting.
- Service
Bus stringRule Id - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
- Storage
Account stringId - The resource ID of the storage account to which you would like to send Diagnostic Logs.
- Workspace
Id string - The workspace ID (resource ID of a Log Analytics workspace) for a 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
- String
- The resource Id for the event hub authorization rule.
- event
Hub StringName - The name of the event hub. If none is specified, the default event hub will be selected.
- logs
List<Log
Settings> - The list of logs settings.
- name String
- The name of the diagnostic setting.
- service
Bus StringRule Id - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
- storage
Account StringId - The resource ID of the storage account to which you would like to send Diagnostic Logs.
- workspace
Id String - The workspace ID (resource ID of a Log Analytics workspace) for a 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
- string
- The resource Id for the event hub authorization rule.
- event
Hub stringName - The name of the event hub. If none is specified, the default event hub will be selected.
- logs
Log
Settings[] - The list of logs settings.
- name string
- The name of the diagnostic setting.
- service
Bus stringRule Id - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
- storage
Account stringId - The resource ID of the storage account to which you would like to send Diagnostic Logs.
- workspace
Id string - The workspace ID (resource ID of a Log Analytics workspace) for a 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
- str
- The resource Id for the event hub authorization rule.
- event_
hub_ strname - The name of the event hub. If none is specified, the default event hub will be selected.
- logs
Sequence[Log
Settings Args] - The list of logs settings.
- name str
- The name of the diagnostic setting.
- service_
bus_ strrule_ id - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
- storage_
account_ strid - The resource ID of the storage account to which you would like to send Diagnostic Logs.
- workspace_
id str - The workspace ID (resource ID of a Log Analytics workspace) for a 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
- String
- The resource Id for the event hub authorization rule.
- event
Hub StringName - The name of the event hub. If none is specified, the default event hub will be selected.
- logs List<Property Map>
- The list of logs settings.
- name String
- The name of the diagnostic setting.
- service
Bus StringRule Id - The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility.
- storage
Account StringId - The resource ID of the storage account to which you would like to send Diagnostic Logs.
- workspace
Id String - The workspace ID (resource ID of a Log Analytics workspace) for a 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:
Supporting Types
Category, CategoryArgs
- Audit
Logs - AuditLogs
- Sign
In Logs - SignInLogs
- Category
Audit Logs - AuditLogs
- Category
Sign In Logs - SignInLogs
- Audit
Logs - AuditLogs
- Sign
In Logs - SignInLogs
- Audit
Logs - AuditLogs
- Sign
In Logs - SignInLogs
- AUDIT_LOGS
- AuditLogs
- SIGN_IN_LOGS
- SignInLogs
- "Audit
Logs" - AuditLogs
- "Sign
In Logs" - SignInLogs
LogSettings, LogSettingsArgs
- Enabled bool
- A value indicating whether this log is enabled.
- Category
string | Pulumi.
Azure Native. Aad Iam. Category - 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 Pulumi.Azure Native. Aad Iam. Inputs. Retention Policy - The retention policy for this log.
- Enabled bool
- A value indicating whether this log is enabled.
- Category string | Category
- 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.
- enabled Boolean
- A value indicating whether this log is enabled.
- category String | Category
- 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.
- enabled boolean
- A value indicating whether this log is enabled.
- category string | Category
- 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.
- enabled bool
- A value indicating whether this log is enabled.
- category str | Category
- 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.
- enabled Boolean
- A value indicating whether this log is enabled.
- category
String | "Audit
Logs" | "Sign In Logs" - 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 Property Map - The retention policy for this log.
LogSettingsResponse, LogSettingsResponseArgs
- 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.
- Retention
Policy Pulumi.Azure Native. Aad Iam. Inputs. Retention Policy Response - 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.
- Retention
Policy RetentionPolicy Response - 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.
- retention
Policy RetentionPolicy Response - 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.
- retention
Policy RetentionPolicy Response - 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 Response - 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.
- retention
Policy Property Map - The retention policy for this log.
RetentionPolicy, RetentionPolicyArgs
RetentionPolicyResponse, RetentionPolicyResponseArgs
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:aadiam:DiagnosticSetting mysetting /providers/microsoft.aadiam/diagnosticSettings/{name}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Native pulumi/pulumi-azure-native
- License
- Apache-2.0