Forum Discussion
How can I automate connecting new subscriptions to a central Log Analytics Workspace?
Our organization has a single Log Analytics Workspace that all our subscriptions are connected and sending their logs to.
Currently we must browse to that LA blade in the portal, click Azure Activity Log, find the subscription and the click Connect on the new blade.
Is there a way to automate this?
Thanks!
You will need to know the workspace ID. Then use PowerShell.
Azure AZ module:
New-AzOperationalInsightsAzureActivityLogDataSource -ResourceGroupName <LogAnalyticsOMSWorkspaceResourceGroupName> -WorkspaceName <LogAnalyticsOMSWorkspaceName> -Name <NameOfThisOperationalInsightsAzureActivityLogDataSource> -SubscriptionId <Subscription>
AzureRM module:
New-AzureRmOperationalInsightsAzureActivityLogDataSource -ResourceGroupName <LogAnalyticsOMSWorkspaceResourceGroupName> -WorkspaceName <LogAnalyticsOMSWorkspaceName> -Name <NameOfThisOperationalInsightsAzureActivityLogDataSource> -SubscriptionId <Subscription>
Cheers
Craig
- CraigWilson_Brass Contributor
You will need to know the workspace ID. Then use PowerShell.
Azure AZ module:
New-AzOperationalInsightsAzureActivityLogDataSource -ResourceGroupName <LogAnalyticsOMSWorkspaceResourceGroupName> -WorkspaceName <LogAnalyticsOMSWorkspaceName> -Name <NameOfThisOperationalInsightsAzureActivityLogDataSource> -SubscriptionId <Subscription>
AzureRM module:
New-AzureRmOperationalInsightsAzureActivityLogDataSource -ResourceGroupName <LogAnalyticsOMSWorkspaceResourceGroupName> -WorkspaceName <LogAnalyticsOMSWorkspaceName> -Name <NameOfThisOperationalInsightsAzureActivityLogDataSource> -SubscriptionId <Subscription>
Cheers
Craig
- AWSullivanCopper Contributor
CraigWilson_ Thanks for the response.
This is a great option for us. Do you know if this can be enforced with a DINE policy?