Skip to content

Instantly share code, notes, and snippets.

@jikuja
Created July 31, 2024 10:50
Show Gist options
  • Save jikuja/27499a98ef18931057e6075afbfe2d89 to your computer and use it in GitHub Desktop.
Save jikuja/27499a98ef18931057e6075afbfe2d89 to your computer and use it in GitHub Desktop.
Azure activity logs

Activity logs on management groups

Directory activity log

Diagnostics setting creation

$mg = Get-AzManagementGroup -GroupName "test"

$wsId =  # fill this
$conf = New-AzDiagnosticSettingLogSettingsObject -Category "Administrative" -Enabled $true
New-AzDiagnosticSetting -Name foo -ResourceId $mg.Id -WorkspaceId $wsId -Log $conf

This creates diagnostics setting on management group level but activity logs are ingestes only from contained subscriptions.

If you need to store management group-level activity logs you need to do your own logic. Examples:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment