azure-native.insights.ManagementGroupDiagnosticSetting
Explore with Pulumi AI
The management group diagnostic setting resource. API Version: 2020-01-01-preview.
Example Usage
Creates or Updates the management group diagnostic setting
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var managementGroupDiagnosticSetting = new AzureNative.Insights.ManagementGroupDiagnosticSetting("managementGroupDiagnosticSetting", new()
{
EventHubAuthorizationRuleId = "/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
EventHubName = "myeventhub",
Logs = new[]
{
new AzureNative.Insights.Inputs.ManagementGroupLogSettingsArgs
{
Category = "Administrative",
Enabled = true,
},
new AzureNative.Insights.Inputs.ManagementGroupLogSettingsArgs
{
Category = "Policy",
Enabled = true,
},
},
ManagementGroupId = "testChildMG7",
Name = "setting1",
StorageAccountId = "/subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5",
WorkspaceId = "/subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace",
});
});
package main
import (
insights "github.com/pulumi/pulumi-azure-native-sdk/insights"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := insights.NewManagementGroupDiagnosticSetting(ctx, "managementGroupDiagnosticSetting", &insights.ManagementGroupDiagnosticSettingArgs{
EventHubAuthorizationRuleId: pulumi.String("/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule"),
EventHubName: pulumi.String("myeventhub"),
Logs: []insights.ManagementGroupLogSettingsArgs{
{
Category: pulumi.String("Administrative"),
Enabled: pulumi.Bool(true),
},
{
Category: pulumi.String("Policy"),
Enabled: pulumi.Bool(true),
},
},
ManagementGroupId: pulumi.String("testChildMG7"),
Name: pulumi.String("setting1"),
StorageAccountId: pulumi.String("/subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5"),
WorkspaceId: pulumi.String("/subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace"),
})
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.insights.ManagementGroupDiagnosticSetting;
import com.pulumi.azurenative.insights.ManagementGroupDiagnosticSettingArgs;
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 managementGroupDiagnosticSetting = new ManagementGroupDiagnosticSetting("managementGroupDiagnosticSetting", ManagementGroupDiagnosticSettingArgs.builder()
.eventHubAuthorizationRuleId("/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule")
.eventHubName("myeventhub")
.logs(
Map.ofEntries(
Map.entry("category", "Administrative"),
Map.entry("enabled", true)
),
Map.ofEntries(
Map.entry("category", "Policy"),
Map.entry("enabled", true)
))
.managementGroupId("testChildMG7")
.name("setting1")
.storageAccountId("/subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5")
.workspaceId("/subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace")
.build());
}
}
import pulumi
import pulumi_azure_native as azure_native
management_group_diagnostic_setting = azure_native.insights.ManagementGroupDiagnosticSetting("managementGroupDiagnosticSetting",
event_hub_authorization_rule_id="/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
event_hub_name="myeventhub",
logs=[
azure_native.insights.ManagementGroupLogSettingsArgs(
category="Administrative",
enabled=True,
),
azure_native.insights.ManagementGroupLogSettingsArgs(
category="Policy",
enabled=True,
),
],
management_group_id="testChildMG7",
name="setting1",
storage_account_id="/subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5",
workspace_id="/subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace")
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";
const managementGroupDiagnosticSetting = new azure_native.insights.ManagementGroupDiagnosticSetting("managementGroupDiagnosticSetting", {
eventHubAuthorizationRuleId: "/subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule",
eventHubName: "myeventhub",
logs: [
{
category: "Administrative",
enabled: true,
},
{
category: "Policy",
enabled: true,
},
],
managementGroupId: "testChildMG7",
name: "setting1",
storageAccountId: "/subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5",
workspaceId: "/subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace",
});
resources:
managementGroupDiagnosticSetting:
type: azure-native:insights:ManagementGroupDiagnosticSetting
properties:
eventHubAuthorizationRuleId: /subscriptions/fb9f25f9-5785-4510-a38f-a62f188eb9f8/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/eventhubs/myeventhub/authorizationrules/myrule
eventHubName: myeventhub
logs:
- category: Administrative
enabled: true
- category: Policy
enabled: true
managementGroupId: testChildMG7
name: setting1
storageAccountId: /subscriptions/bfaef57f-297e-4210-bfe5-27c18cc671f7/resourceGroups/FuncAppRunners/providers/Microsoft.Storage/storageAccounts/testpersonalb6a5
workspaceId: /subscriptions/9cf7cc0a-0ba1-4624-bc82-97e1ee25dc45/resourceGroups/mgTest/providers/Microsoft.OperationalInsights/workspaces/mgTestWorkspace
Create ManagementGroupDiagnosticSetting Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ManagementGroupDiagnosticSetting(name: string, args: ManagementGroupDiagnosticSettingArgs, opts?: CustomResourceOptions);
@overload
def ManagementGroupDiagnosticSetting(resource_name: str,
args: ManagementGroupDiagnosticSettingArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ManagementGroupDiagnosticSetting(resource_name: str,
opts: Optional[ResourceOptions] = None,
management_group_id: Optional[str] = None,
event_hub_authorization_rule_id: Optional[str] = None,
event_hub_name: Optional[str] = None,
location: Optional[str] = None,
logs: Optional[Sequence[ManagementGroupLogSettingsArgs]] = None,
name: Optional[str] = None,
service_bus_rule_id: Optional[str] = None,
storage_account_id: Optional[str] = None,
workspace_id: Optional[str] = None)
func NewManagementGroupDiagnosticSetting(ctx *Context, name string, args ManagementGroupDiagnosticSettingArgs, opts ...ResourceOption) (*ManagementGroupDiagnosticSetting, error)
public ManagementGroupDiagnosticSetting(string name, ManagementGroupDiagnosticSettingArgs args, CustomResourceOptions? opts = null)
public ManagementGroupDiagnosticSetting(String name, ManagementGroupDiagnosticSettingArgs args)
public ManagementGroupDiagnosticSetting(String name, ManagementGroupDiagnosticSettingArgs args, CustomResourceOptions options)
type: azure-native:insights:ManagementGroupDiagnosticSetting
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 ManagementGroupDiagnosticSettingArgs
- 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 ManagementGroupDiagnosticSettingArgs
- 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 ManagementGroupDiagnosticSettingArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ManagementGroupDiagnosticSettingArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ManagementGroupDiagnosticSettingArgs
- 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 managementGroupDiagnosticSettingResource = new AzureNative.Insights.ManagementGroupDiagnosticSetting("managementGroupDiagnosticSettingResource", new()
{
ManagementGroupId = "string",
EventHubAuthorizationRuleId = "string",
EventHubName = "string",
Location = "string",
Logs = new[]
{
{
{ "category", "string" },
{ "enabled", false },
},
},
Name = "string",
ServiceBusRuleId = "string",
StorageAccountId = "string",
WorkspaceId = "string",
});
example, err := insights.NewManagementGroupDiagnosticSetting(ctx, "managementGroupDiagnosticSettingResource", &insights.ManagementGroupDiagnosticSettingArgs{
ManagementGroupId: "string",
EventHubAuthorizationRuleId: "string",
EventHubName: "string",
Location: "string",
Logs: []map[string]interface{}{
map[string]interface{}{
"category": "string",
"enabled": false,
},
},
Name: "string",
ServiceBusRuleId: "string",
StorageAccountId: "string",
WorkspaceId: "string",
})
var managementGroupDiagnosticSettingResource = new ManagementGroupDiagnosticSetting("managementGroupDiagnosticSettingResource", ManagementGroupDiagnosticSettingArgs.builder()
.managementGroupId("string")
.eventHubAuthorizationRuleId("string")
.eventHubName("string")
.location("string")
.logs(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.name("string")
.serviceBusRuleId("string")
.storageAccountId("string")
.workspaceId("string")
.build());
management_group_diagnostic_setting_resource = azure_native.insights.ManagementGroupDiagnosticSetting("managementGroupDiagnosticSettingResource",
management_group_id=string,
event_hub_authorization_rule_id=string,
event_hub_name=string,
location=string,
logs=[{
category: string,
enabled: False,
}],
name=string,
service_bus_rule_id=string,
storage_account_id=string,
workspace_id=string)
const managementGroupDiagnosticSettingResource = new azure_native.insights.ManagementGroupDiagnosticSetting("managementGroupDiagnosticSettingResource", {
managementGroupId: "string",
eventHubAuthorizationRuleId: "string",
eventHubName: "string",
location: "string",
logs: [{
category: "string",
enabled: false,
}],
name: "string",
serviceBusRuleId: "string",
storageAccountId: "string",
workspaceId: "string",
});
type: azure-native:insights:ManagementGroupDiagnosticSetting
properties:
eventHubAuthorizationRuleId: string
eventHubName: string
location: string
logs:
- category: string
enabled: false
managementGroupId: string
name: string
serviceBusRuleId: string
storageAccountId: string
workspaceId: string
ManagementGroupDiagnosticSetting 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 ManagementGroupDiagnosticSetting resource accepts the following input properties:
- Management
Group stringId - The management group id.
- 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.
- Location string
- Location of the resource
- Logs
List<Pulumi.
Azure Native. Insights. Inputs. Management Group 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 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
- Management
Group stringId - The management group id.
- 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.
- Location string
- Location of the resource
- Logs
[]Management
Group 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 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
- management
Group StringId - The management group id.
- 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.
- location String
- Location of the resource
- logs
List<Management
Group 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 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
- management
Group stringId - The management group id.
- 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.
- location string
- Location of the resource
- logs
Management
Group 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 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
- management_
group_ strid - The management group id.
- 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.
- location str
- Location of the resource
- logs
Sequence[Management
Group 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 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
- management
Group StringId - The management group id.
- 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.
- location String
- Location of the resource
- 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 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 ManagementGroupDiagnosticSetting resource produces the following output properties:
Supporting Types
ManagementGroupLogSettings, ManagementGroupLogSettingsArgs
ManagementGroupLogSettingsResponse, ManagementGroupLogSettingsResponseArgs
Import
An existing resource can be imported using its type token, name, and identifier, e.g.
$ pulumi import azure-native:insights:ManagementGroupDiagnosticSetting setting1 providers/Microsoft.Management/managementGroups/testChildMG7/providers/microsoft.insights/diagnosticSettings/setting1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- azure-native-v1 pulumi/pulumi-azure-native
- License
- Apache-2.0