Skip to content

Commit 5c78298

Browse files
committed
PowerShell and ARM
1 parent 0a31c1f commit 5c78298

File tree

1 file changed

+91
-1
lines changed

1 file changed

+91
-1
lines changed

articles/azure-monitor/platform/activity-log-collect.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The following column have been added:
105105
106106

107107
## Activity Logs Analytics monitoring solution
108-
The Azure Log Analytics monitoring solution is currently being deprecated but can still be used if you already have it enabled.
108+
The Azure Log Analytics monitoring solution is currently being deprecated but can still be used if you already have it enabled. The option to enable the solution for a new subscription has been removed from the Azure portal, but you can enable it using the template and procedure in [Enable solution for new subscription](#enable-solution-for-new-subscription).
109109

110110

111111
### Use the solution
@@ -125,6 +125,96 @@ Click the **Azure Activity Logs** tile to open the **Azure Activity Logs** view.
125125
| Activity Logs by Resource | Shows the total number of resources with Activity Logs and lists the top ten resources with record counts for each resource. Click the total area to run a log search for `AzureActivity | summarize AggregatedValue = count() by Resource`, which shows all Azure resources available to the solution. Click a resource to run a log query returning all activity records for that resource. |
126126
| Activity Logs by Resource Provider | Shows the total number of resource providers that produce Activity Logs and lists the top ten. Click the total area to run a log query for `AzureActivity | summarize AggregatedValue = count() by ResourceProvider`, which shows all Azure resource providers. Click a resource provider to run a log query returning all activity records for the provider. |
127127

128+
## Enable solution for new subscription
129+
To enable the solution to collect and analyze the Activity log for a new subscription, follow the procedure below.
130+
131+
1. Copy the following json into a file called *ActivityLogTemplate*.json.
132+
133+
```json
134+
{
135+
"$schema": "https://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
136+
"contentVersion": "1.0.0.0",
137+
"parameters": {
138+
"workspaceName": {
139+
"type": "String",
140+
"defaultValue": "my-workspace",
141+
"metadata": {
142+
"description": "Specifies the name of the workspace."
143+
}
144+
},
145+
"location": {
146+
"type": "String",
147+
"allowedValues": [
148+
"east us",
149+
"west us",
150+
"australia central",
151+
"west europe"
152+
],
153+
"defaultValue": "australia central",
154+
"metadata": {
155+
"description": "Specifies the location in which to create the workspace."
156+
}
157+
}
158+
},
159+
"resources": [
160+
{
161+
"type": "Microsoft.OperationalInsights/workspaces",
162+
"name": "[parameters('workspaceName')]",
163+
"apiVersion": "2015-11-01-preview",
164+
"location": "[parameters('location')]",
165+
"properties": {
166+
"features": {
167+
"searchVersion": 2
168+
}
169+
}
170+
},
171+
{
172+
"type": "Microsoft.OperationsManagement/solutions",
173+
"apiVersion": "2015-11-01-preview",
174+
"name": "[concat('AzureActivity(', parameters('workspaceName'),')')]",
175+
"location": "[parameters('location')]",
176+
"dependsOn": [
177+
"[resourceId('microsoft.operationalinsights/workspaces', parameters('workspaceName'))]"
178+
],
179+
"plan": {
180+
"name": "[concat('AzureActivity(', parameters('workspaceName'),')')]",
181+
"promotionCode": "",
182+
"product": "OMSGallery/AzureActivity",
183+
"publisher": "Microsoft"
184+
},
185+
"properties": {
186+
"workspaceResourceId": "[resourceId('microsoft.operationalinsights/workspaces', parameters('workspaceName'))]",
187+
"containedResources": [
188+
"[concat(resourceId('microsoft.operationalinsights/workspaces', parameters('workspaceName')), '/views/AzureActivity(',parameters('workspaceName'))]"
189+
]
190+
}
191+
},
192+
{
193+
"type": "Microsoft.OperationalInsights/workspaces/datasources",
194+
"kind": "AzureActivityLog",
195+
"name": "[concat(parameters('workspaceName'), '/', subscription().subscriptionId)]",
196+
"apiVersion": "2015-11-01-preview",
197+
"location": "[parameters('location')]",
198+
"dependsOn": [
199+
"[parameters('WorkspaceName')]"
200+
],
201+
"properties": {
202+
"linkedResourceId": "[concat(subscription().Id, '/providers/microsoft.insights/eventTypes/management')]"
203+
}
204+
}
205+
]
206+
}
207+
```
208+
209+
2. Deploy the template using the following PowerShell commands:
210+
211+
```PowerShell
212+
Connect-AzAccount
213+
Select-AzSubscription <SubscriptionName>
214+
New-AzResourceGroupDeployment -Name activitysolution -ResourceGroupName <ResourceGroup> -TemplateFile <Path to template file>
215+
```
216+
217+
128218
## Next steps
129219

130220
- Learn more about the [Activity Log](platform-logs-overview.md).

0 commit comments

Comments
 (0)