Skip to content

Commit d02b4a8

Browse files
authored
Update azure-monitor-agent-manage.md
1 parent f5c599f commit d02b4a8

File tree

1 file changed

+65
-19
lines changed

1 file changed

+65
-19
lines changed

articles/azure-monitor/agents/azure-monitor-agent-manage.md

Lines changed: 65 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,9 @@ N/A
396396
397397
[Install AMA](#installation-options) on your VM.
398398
399-
1. **Create a DCR via template deployment:**
399+
1. **Create a DCR:**
400400
401-
The following example sets the maximum amount of disk space used by AMA cache to 5000 MB.
401+
This example sets the maximum amount of disk space used by AMA cache to 5000 MB.
402402
403403
```json
404404
{
@@ -430,24 +430,70 @@ N/A
430430
}
431431
```
432432
433-
> [!NOTE]
434-
> Use the Get DataCollectionRule API to get the DCR payload you created with this template.
435-
436-
1. **Associate DCR with your machine:**
433+
1. **Associate the DCR with your machine:**
437434
438-
This can be done with a template or by using the [Create API](/rest/api/monitor/data-collection-rule-associations/create) with the following details:
439-
440-
* **AssociationName:** agentSettings
441-
* **ResourceUri:** Full ARM ID of the VM
442-
* **api-version:** 2023-03-11 (Old API version is also fine)
443-
* **Body:**
444-
```json
445-
{
446-
"properties": {
447-
"dataCollectionRuleId": “Full ARM ID for agent setting DCR”
448-
}
449-
}
450-
```
435+
Use these ARM template and parameter files:
436+
437+
**ARM template file**
438+
439+
```json
440+
{
441+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
442+
"contentVersion": "1.0.0.0",
443+
"parameters": {
444+
"vmName": {
445+
"type": "string",
446+
"metadata": {
447+
"description": "The name of the virtual machine."
448+
}
449+
},
450+
"associationName": {
451+
"type": "string",
452+
"metadata": {
453+
"description": "The name of the association."
454+
}
455+
},
456+
"dataCollectionRuleId": {
457+
"type": "string",
458+
"metadata": {
459+
"description": "The resource ID of the data collection rule."
460+
}
461+
}
462+
},
463+
"resources": [
464+
{
465+
"type": "Microsoft.Insights/dataCollectionRuleAssociations",
466+
"apiVersion": "2021-09-01-preview",
467+
"scope": "[format('Microsoft.Compute/virtualMachines/{0}', parameters('vmName'))]",
468+
"name": "[parameters('associationName')]",
469+
"properties": {
470+
"description": "Association of data collection rule. Deleting this association will break the data collection for this virtual machine.",
471+
"dataCollectionRuleId": "[parameters('dataCollectionRuleId')]"
472+
}
473+
}
474+
]
475+
}
476+
```
477+
478+
**Parameter file**
479+
480+
```json
481+
{
482+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
483+
"contentVersion": "1.0.0.0",
484+
"parameters": {
485+
"vmName": {
486+
"value": "my-azure-vm"
487+
},
488+
"associationName": {
489+
"value": "my-windows-vm-my-dcr"
490+
},
491+
"dataCollectionRuleId": {
492+
"value": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/my-resource-group/providers/microsoft.insights/datacollectionrules/my-dcr"
493+
}
494+
}
495+
}
496+
```
451497
452498
1. **Activate the settings:**
453499

0 commit comments

Comments
 (0)