Felix Bodmer
Felix Bodmer

Reputation: 291

Connecting Azure Activity Log to Log Analytics instance using PowerShell

Is there a way to configure Azure Activity logs to be forwarded to a Log Analytics instance using PowerShell? Essentially the same that can be performed using the Portal as outlined on this page: https://learn.microsoft.com/en-us/azure/azure-monitor/platform/collect-activity-logs#configuration

Upvotes: 1

Views: 668

Answers (1)

KrishnaG
KrishnaG

Reputation: 3484

You may use the PowerShell cmdlet New-AzureRmOperationalInsightsAzureActivityLogDataSource.

Illustration:

New-AzureRmOperationalInsightsAzureActivityLogDataSource -ResourceGroupName <LogAnalyticsOMSWorkspaceResourceGroupName> -WorkspaceName <LogAnalyticsOMSWorkspaceName> -Name <NameOfThisOperationalInsightsAzureActivityLogDataSource> -SubscriptionId <SubscriptionId>

For more information refer https://learn.microsoft.com/en-us/powershell/module/azurerm.operationalinsights/New-AzureRmOperationalInsightsAzureActivityLogDataSource?view=azurermps-6.13.0

Hope this helps!!

Upvotes: 1

Related Questions