Skip to content

Commit a6d2c2a

Browse files
committed
add one more Bicep example
1 parent c338f79 commit a6d2c2a

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

articles/azure-monitor/agents/resource-manager-agent.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ This article includes sample [Azure Resource Manager templates](../../azure-reso
1313

1414
[!INCLUDE [azure-monitor-samples](../../../includes/azure-monitor-resource-manager-samples.md)]
1515

16-
1716
## Azure Monitor agent
18-
The samples in this section install the Azure Monitor agent on Windows and Linux virtual machines and Azure Arc-enabled servers. To configure data collection for these agents, you must also deploy [Resource Manager templates data collection rules and associations](./resource-manager-data-collection-rules.md).
1917

18+
The samples in this section install the Azure Monitor agent on Windows and Linux virtual machines and Azure Arc-enabled servers. To configure data collection for these agents, you must also deploy [Resource Manager templates data collection rules and associations](./resource-manager-data-collection-rules.md).
2019

2120
## Permissions required
2221

@@ -37,7 +36,7 @@ The following sample installs the Azure Monitor agent on a Windows Azure virtual
3736
param vmName string
3837
param location string
3938
40-
resource agent 'Microsoft.Compute/virtualMachines/extensions@2021-11-01' = {
39+
resource windowsAgent 'Microsoft.Compute/virtualMachines/extensions@2021-11-01' = {
4140
name: '${vmName}/AzureMonitorWindowsAgent'
4241
location: location
4342
properties: {
@@ -113,7 +112,7 @@ The following sample installs the Azure Monitor agent on a Linux Azure virtual m
113112
param vmName string
114113
param location string
115114
116-
resource agent 'Microsoft.Compute/virtualMachines/extensions@2021-11-01' = {
115+
resource linuxAgent 'Microsoft.Compute/virtualMachines/extensions@2021-11-01' = {
117116
name: '${vmName}/AzureMonitorLinuxAgent'
118117
location: location
119118
properties: {
@@ -183,34 +182,55 @@ The following sample installs the Azure Monitor agent on a Windows Azure Arc-ena
183182

184183
#### Template file
185184

185+
# [Bicep](#tab/bicep)
186+
187+
```bicep
188+
param vmName string
189+
param location string
190+
191+
resource windowsAgent 'Microsoft.HybridCompute/machines/extensions@2021-12-10-preview' = {
192+
name: '${vmName}/AzureMonitorWindowsAgent'
193+
location: location
194+
properties: {
195+
publisher: 'Microsoft.Azure.Monitor'
196+
type: 'AzureMonitorWindowsAgent'
197+
autoUpgradeMinorVersion: true
198+
}
199+
}
200+
```
201+
202+
# [JSON](#tab/json)
203+
186204
```json
187205
{
188-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
206+
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
189207
"contentVersion": "1.0.0.0",
190208
"parameters": {
191-
"vmName": {
192-
"type": "string"
193-
},
194-
"location": {
195-
"type": "string"
196-
}
209+
"vmName": {
210+
"type": "string"
211+
},
212+
"location": {
213+
"type": "string"
214+
}
197215
},
198216
"resources": [
199-
{
200-
"name": "[concat(parameters('vmName'),'/AzureMonitorWindowsAgent')]",
201-
"type": "Microsoft.HybridCompute/machines/extensions",
202-
"location": "[parameters('location')]",
203-
"apiVersion": "2019-08-02-preview",
204-
"properties": {
205-
"publisher": "Microsoft.Azure.Monitor",
206-
"type": "AzureMonitorWindowsAgent",
207-
"autoUpgradeMinorVersion": true
208-
}
217+
{
218+
"type": "Microsoft.HybridCompute/machines/extensions",
219+
"apiVersion": "2021-12-10-preview",
220+
"name": "[format('{0}/AzureMonitorWindowsAgent', parameters('vmName'))]",
221+
"location": "[parameters('location')]",
222+
"properties": {
223+
"publisher": "Microsoft.Azure.Monitor",
224+
"type": "AzureMonitorWindowsAgent",
225+
"autoUpgradeMinorVersion": true
209226
}
227+
}
210228
]
211229
}
212230
```
213231

232+
---
233+
214234
#### Parameter file
215235

216236
```json
@@ -239,7 +259,7 @@ The following sample installs the Azure Monitor agent on a Linux Azure Arc-enabl
239259
param vmName string
240260
param location string
241261

242-
resource agent 'Microsoft.HybridCompute/machines/extensions@2021-12-10-preview'= {
262+
resource linuxAgent 'Microsoft.HybridCompute/machines/extensions@2021-12-10-preview'= {
243263
name: '${vmName}/AzureMonitorWindowsAgent'
244264
location: location
245265
properties: {

0 commit comments

Comments
 (0)