-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAMA-UAI-ARM-Template.json
357 lines (357 loc) · 12.4 KB
/
AMA-UAI-ARM-Template.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"vmName": {
"type": "String"
},
"adminUsername": {
"type": "string",
"metadata": {
"description": "Username for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "Password for the Virtual Machine."
}
},
"dnsLabelPrefix": {
"type": "string",
"metadata": {
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
}
},
"windowsOSVersion": {
"type": "string",
"defaultValue": "2016-Datacenter",
"allowedValues": [
"2008-R2-SP1",
"2012-Datacenter",
"2012-R2-Datacenter",
"2016-Nano-Server",
"2016-Datacenter-with-Containers",
"2016-Datacenter",
"2019-Datacenter"
],
"metadata": {
"description": "The Windows version for the VM. This will pick a fully patched image of this given Windows version."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"builtInRoleType": {
"type": "string",
"defaultValue": "Reader"
},
"dataCollectionRules_name": {
"defaultValue": "[concat(resourceGroup().name, '-DCR')]",
"type": "String"
},
"workspace_resource_id": {
"type": "String"
},
"associationName": {
"type": "string",
"defaultValue": "[concat(uniquestring(resourceGroup().id), '-DCRLink')]",
"metadata": {
"description": "Name of the association."
}
}
},
"variables": {
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'sawinvm')]",
"nicName": "[concat(uniquestring(resourceGroup().id), 'myVmNic')]",
"addressPrefix": "10.0.0.0/16",
"subnetName": "Subnet",
"subnetPrefix": "10.0.0.0/24",
"publicIPAddressName": "[concat(uniquestring(resourceGroup().id), 'myPubIp')]",
"virtualNetworkName": "[concat(uniquestring(resourceGroup().id), 'myVmNet')]",
"subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]",
"Reader": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')]",
"apiVersion": "2020-06-01"
},
"resources": [
{
"type": "Microsoft.Insights/dataCollectionRules",
"apiVersion": "2021-04-01",
"name": "[parameters('dataCollectionRules_name')]",
"location": "[parameters('location')]",
"kind": "Windows",
"properties": {
"dataSources": {
"performanceCounters": [
{
"streams": [
"Microsoft-Perf"
],
"samplingFrequencyInSeconds": 10,
"counterSpecifiers": [
"\\Processor Information(_Total)\\% Processor Time",
"\\Processor Information(_Total)\\% Privileged Time",
"\\Processor Information(_Total)\\% User Time",
"\\Processor Information(_Total)\\Processor Frequency",
"\\System\\Processes",
"\\Process(_Total)\\Thread Count",
"\\Process(_Total)\\Handle Count",
"\\System\\System Up Time",
"\\System\\Context Switches/sec",
"\\System\\Processor Queue Length",
"\\Memory\\% Committed Bytes In Use",
"\\Memory\\Available Bytes",
"\\Memory\\Committed Bytes",
"\\Memory\\Cache Bytes",
"\\Memory\\Pool Paged Bytes",
"\\Memory\\Pool Nonpaged Bytes",
"\\Memory\\Pages/sec",
"\\Memory\\Page Faults/sec",
"\\Process(_Total)\\Working Set",
"\\Process(_Total)\\Working Set - Private",
"\\LogicalDisk(_Total)\\% Disk Time",
"\\LogicalDisk(_Total)\\% Disk Read Time",
"\\LogicalDisk(_Total)\\% Disk Write Time",
"\\LogicalDisk(_Total)\\% Idle Time",
"\\LogicalDisk(_Total)\\Disk Bytes/sec",
"\\LogicalDisk(_Total)\\Disk Read Bytes/sec",
"\\LogicalDisk(_Total)\\Disk Write Bytes/sec",
"\\LogicalDisk(_Total)\\Disk Transfers/sec",
"\\LogicalDisk(_Total)\\Disk Reads/sec",
"\\LogicalDisk(_Total)\\Disk Writes/sec",
"\\LogicalDisk(_Total)\\Avg. Disk sec/Transfer",
"\\LogicalDisk(_Total)\\Avg. Disk sec/Read",
"\\LogicalDisk(_Total)\\Avg. Disk sec/Write",
"\\LogicalDisk(_Total)\\Avg. Disk Queue Length",
"\\LogicalDisk(_Total)\\Avg. Disk Read Queue Length",
"\\LogicalDisk(_Total)\\Avg. Disk Write Queue Length",
"\\LogicalDisk(_Total)\\% Free Space",
"\\LogicalDisk(_Total)\\Free Megabytes",
"\\Network Interface(*)\\Bytes Total/sec",
"\\Network Interface(*)\\Bytes Sent/sec",
"\\Network Interface(*)\\Bytes Received/sec",
"\\Network Interface(*)\\Packets/sec",
"\\Network Interface(*)\\Packets Sent/sec",
"\\Network Interface(*)\\Packets Received/sec",
"\\Network Interface(*)\\Packets Outbound Errors",
"\\Network Interface(*)\\Packets Received Errors"
],
"name": "perfCounterDataSource10"
}
],
"windowsEventLogs": [
{
"streams": [
"Microsoft-Event"
],
"xPathQueries": [
"Application!*[System[(Level=2)]]",
"System!*[System[(Level=2)]]"
],
"name": "eventLogsDataSource"
}
]
},
"destinations": {
"logAnalytics": [
{
"workspaceResourceId": "[parameters('workspace_resource_id')]",
"name": "la-622494052"
}
]
},
"dataFlows": [
{
"streams": [
"Microsoft-Perf",
"Microsoft-Event"
],
"destinations": [
"la-622494052"
]
}
]
}
},
{
"name": "[parameters('vmName')]",
"type": "Microsoft.ManagedIdentity/userAssignedIdentities",
"apiVersion": "2018-11-30",
"tags": {},
"location": "[parameters('location')]"
},
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2018-11-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"sku": {
"name": "Standard_LRS"
},
"kind": "Storage",
"properties": {}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2018-11-01",
"name": "[variables('publicIPAddressName')]",
"location": "[parameters('location')]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": {
"domainNameLabel": "[parameters('dnsLabelPrefix')]"
}
}
},
{
"type": "Microsoft.Network/virtualNetworks",
"apiVersion": "2018-11-01",
"name": "[variables('virtualNetworkName')]",
"location": "[parameters('location')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('addressPrefix')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2018-11-01",
"name": "[variables('nicName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2018-10-01",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"identity": {
"type": "userAssigned",
"userAssignedIdentities": {
"[resourceID('Microsoft.ManagedIdentity/userAssignedIdentities/',parameters('vmName'))]": {}
}
},
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
"[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]",
"[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities/', parameters('vmName'))]"
],
"properties": {
"hardwareProfile": {
"vmSize": "Standard_A2"
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "[parameters('windowsOSVersion')]",
"version": "latest"
},
"osDisk": {
"createOption": "FromImage"
},
"dataDisks": [
{
"diskSizeGB": 1023,
"lun": 0,
"createOption": "Empty"
}
]
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob]"
}
}
}
},
{
"type": "Microsoft.Compute/virtualMachines/providers/dataCollectionRuleAssociations",
"name": "[concat(parameters('vmName'),'/microsoft.insights/', parameters('associationName'))]",
"apiVersion": "2019-11-01-preview",
"properties": {
"description": "Association of data collection rule. Deleting this association will break the data collection for this virtual machine.",
"dataCollectionRuleId": "[resourceID('Microsoft.Insights/dataCollectionRules',parameters('dataCollectionRules_name'))]"
},
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
]
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('vmName'), '/AMAExtension')]",
"apiVersion": "[variables('apiVersion')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines/providers/dataCollectionRuleAssociations', parameters('vmName'), 'Microsoft.Insights', parameters('associationName'))]"
],
"properties": {
"publisher": "Microsoft.Azure.Monitor",
"type": "AzureMonitorWindowsAgent",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": true,
"settings": {
"authentication": {
"managedIdentity": {
"identifier-type": "mi_res_id",
"identifier-value": "[resourceID('Microsoft.ManagedIdentity/userAssignedIdentities/',parameters('vmName'))]"
}
}
}
}
}
],
"outputs": {
"hostname": {
"type": "string",
"value": "[reference(variables('publicIPAddressName')).dnsSettings.fqdn]"
}
}
}