Last active
August 17, 2022 06:35
-
-
Save matsest/ebd92760408b07040104c7847f32195a to your computer and use it in GitHub Desktop.
Management Group Diagnostic Settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
targetScope = 'managementGroup' | |
param name string | |
param displayName string = name | |
param parentName string = '' | |
param workspaceResourceId string = '' | |
resource managementGroup 'Microsoft.Management/managementGroups@2021-04-01' = { | |
name: name | |
scope: tenant() | |
properties: { | |
displayName: displayName | |
details: empty(parentName) ? {} : { | |
parent: { | |
id: '/providers/Microsoft.Management/managementGroups/${parentName}' | |
} | |
} | |
} | |
} | |
module diag 'mg-diagsettings.bicep' = if(!empty(workspaceResourceId)) { | |
scope: managementGroup | |
name: '${name}-diag' | |
params: { | |
profileName: 'log-analytics' | |
workspaceResourceId: workspaceResourceId | |
} | |
} | |
output id string = managementGroup.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
targetScope = 'managementGroup' | |
param workspaceResourceId string | |
param profileName string | |
resource diag 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = { | |
name: profileName | |
properties: { | |
workspaceId: workspaceResourceId | |
logs: [ | |
{ | |
category: 'Administrative' | |
enabled: true | |
} | |
{ | |
category: 'Policy' | |
enabled: true | |
} | |
] | |
} | |
} | |
output id string = diag.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment