forked from DanielWep/AVD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
managedDisks-galleryvm.json
512 lines (512 loc) · 19.7 KB
/
managedDisks-galleryvm.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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"artifactsLocation": {
"type": "string",
"metadata": {
"description": "The base URI where artifacts required by this template are located."
}
},
"availabilityOption": {
"type": "string",
"metadata": {
"description": "The availability option for the VMs."
},
"defaultValue": "None",
"allowedValues": [
"None",
"AvailabilitySet",
"AvailabilityZone"
]
},
"availabilitySetName": {
"type": "string",
"metadata": {
"description": "The name of avaiability set to be used when create the VMs."
},
"defaultValue": ""
},
"availabilityZone": {
"type": "int",
"metadata": {
"description": "The number of availability zone to be used when create the VMs."
},
"defaultValue": 1,
"allowedValues": [ 1, 2, 3 ]
},
"vmImageVhdUri": {
"type": "string",
"metadata": {
"description": "URI of the sysprepped image vhd file to be used to create the session host VMs. For example, https://rdsstorage.blob.core.windows.net/vhds/sessionhostimage.vhd"
}
},
"vmGalleryImageOffer": {
"type": "string",
"metadata": {
"description": "(Required when vmImageType = Gallery) Gallery image Offer."
},
"defaultValue": ""
},
"vmGalleryImagePublisher": {
"type": "string",
"metadata": {
"description": "(Required when vmImageType = Gallery) Gallery image Publisher."
},
"defaultValue": ""
},
"vmGalleryImageHasPlan": {
"type": "bool",
"metadata": {
"description": "Whether the VM image has a plan or not"
},
"defaultValue": false
},
"vmGalleryImageSKU": {
"type": "string",
"metadata": {
"description": "(Required when vmImageType = Gallery) Gallery image SKU."
},
"defaultValue": ""
},
"vmGalleryImageVersion": {
"type": "string",
"metadata": {
"description": "(Required when vmImageType = Gallery) Gallery image version."
},
"defaultValue": ""
},
"rdshPrefix": {
"type": "string",
"metadata": {
"description": "This prefix will be used in combination with the VM number to create the VM name. This value includes the dash, so if using “rdsh” as the prefix, VMs would be named “rdsh-0”, “rdsh-1”, etc. You should use a unique prefix to reduce name collisions in Active Directory."
},
"defaultValue": "[take(toLower(resourceGroup().name),10)]"
},
"rdshNumberOfInstances": {
"type": "int",
"metadata": {
"description": "Number of session hosts that will be created and added to the hostpool."
}
},
"rdshVMDiskType": {
"type": "string",
"allowedValues": [ "Premium_LRS", "StandardSSD_LRS", "Standard_LRS" ],
"metadata": {
"description": "The VM disk type for the VM: HDD or SSD."
}
},
"rdshVmSize": {
"type": "string",
"metadata": {
"description": "The size of the session host VMs."
},
"defaultValue": "Standard_A2"
},
"rdshVmDiskSizeGB": {
"type": "int",
"metadata": {
"description": "The size of the disk on the vm in GB"
},
"defaultValue": 0
},
"rdshHibernate": {
"type": "bool",
"metadata": {
"description": "Whether or not the VM is hibernate enabled"
},
"defaultValue": false
},
"enableAcceleratedNetworking": {
"type": "bool",
"metadata": {
"description": "Enables Accelerated Networking feature, notice that VM size must support it, this is supported in most of general purpose and compute-optimized instances with 2 or more vCPUs, on instances that supports hyperthreading it is required minimum of 4 vCPUs."
},
"defaultValue": false
},
"administratorAccountUsername": {
"type": "string",
"metadata": {
"description": "The username for the domain admin."
}
},
"administratorAccountPassword": {
"type": "securestring",
"metadata": {
"description": "The password that corresponds to the existing domain username."
}
},
"vmAdministratorAccountUsername": {
"type": "string",
"metadata": {
"description": "A username to be used as the virtual machine administrator account. The vmAdministratorAccountUsername and vmAdministratorAccountPassword parameters must both be provided. Otherwise, domain administrator credentials provided by administratorAccountUsername and administratorAccountPassword will be used."
},
"defaultValue": ""
},
"vmAdministratorAccountPassword": {
"type": "securestring",
"metadata": {
"description": "The password associated with the virtual machine administrator account. The vmAdministratorAccountUsername and vmAdministratorAccountPassword parameters must both be provided. Otherwise, domain administrator credentials provided by administratorAccountUsername and administratorAccountPassword will be used."
},
"defaultValue": ""
},
"vhds": {
"type": "string",
"metadata": {
"description": "The URL to store unmanaged disks."
}
},
"subnet-id": {
"type": "string",
"metadata": {
"description": "The unique id of the subnet for the nics."
}
},
"rdshImageSourceId": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Resource ID of the image."
}
},
"location": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Location for all resources to be created in."
}
},
"createNetworkSecurityGroup": {
"type": "bool",
"metadata": {
"description": "Whether to create a new network security group or use an existing one"
},
"defaultValue": false
},
"networkSecurityGroupId": {
"type": "string",
"metadata": {
"description": "The resource id of an existing network security group"
},
"defaultValue": ""
},
"networkSecurityGroupRules": {
"type": "array",
"metadata": {
"description": "The rules to be given to the new network security group"
},
"defaultValue": []
},
"networkInterfaceTags": {
"type": "object",
"metadata": {
"description": "The tags to be assigned to the network interfaces"
},
"defaultValue": {}
},
"networkSecurityGroupTags": {
"type": "object",
"metadata": {
"description": "The tags to be assigned to the network security groups"
},
"defaultValue": {}
},
"virtualMachineTags": {
"type": "object",
"metadata": {
"description": "The tags to be assigned to the virtual machines"
},
"defaultValue": {}
},
"imageTags": {
"type": "object",
"metadata": {
"description": "The tags to be assigned to the images"
},
"defaultValue": {}
},
"vmInitialNumber": {
"type": "int",
"metadata": {
"description": "VM name prefix initial number."
},
"defaultValue": 0
},
"_guidValue": {
"type": "string",
"defaultValue": "[newGuid()]"
},
"hostpoolToken": {
"type": "string",
"metadata": {
"description": "The token for adding VMs to the hostpool"
}
},
"hostpoolName": {
"type": "string",
"metadata": {
"description": "The name of the hostpool"
}
},
"ouPath": {
"type": "string",
"metadata": {
"description": "OUPath for the domain join"
},
"defaultValue": ""
},
"domain": {
"type": "string",
"metadata": {
"description": "Domain to join"
},
"defaultValue": ""
},
"aadJoin": {
"type": "bool",
"metadata": {
"description": "IMPORTANT: You can use this parameter for the test purpose only as AAD Join is public preview. True if AAD Join, false if AD join"
},
"defaultValue": false
},
"intune": {
"type": "bool",
"metadata": {
"description": "IMPORTANT: Please don't use this parameter as intune enrollment is not supported yet. True if intune enrollment is selected. False otherwise"
},
"defaultValue": false
},
"bootDiagnostics": {
"type": "object",
"metadata": {
"description": "Boot diagnostics object taken as body of Diagnostics Profile in VM creation"
},
"defaultValue": {
"enabled": false
}
},
"userAssignedIdentity": {
"type": "string",
"metadata": {
"description": "The name of user assigned identity that will assigned to the VMs. This is an optional parameter."
},
"defaultValue": ""
},
"customConfigurationTemplateUrl": {
"type": "string",
"metadata": {
"description": "ARM template that contains custom configurations to be run after the virtual machines are created."
},
"defaultValue": ""
},
"customConfigurationParameterUrl": {
"type": "string",
"metadata": {
"description": "Url to the ARM template parameter file for the customConfigurationTemplateUrl parameter. This input will be used when the template is ran after the VMs have been deployed."
},
"defaultValue": ""
},
"SessionHostConfigurationVersion": {
"type": "string",
"metadata": {
"description": "Session host configuration version of the host pool."
},
"defaultValue": ""
},
"securityType": {
"type": "string",
"metadata": {
"description": "Specifies the SecurityType of the virtual machine. It is set as TrustedLaunch to enable UefiSettings. Default: UefiSettings will not be enabled unless this property is set as TrustedLaunch."
},
"defaultValue": ""
},
"secureBoot": {
"type": "bool",
"metadata": {
"description": "Specifies whether secure boot should be enabled on the virtual machine."
},
"defaultValue": false
},
"vTPM": {
"type": "bool",
"metadata": {
"description": "Specifies whether vTPM (Virtual Trusted Platform Module) should be enabled on the virtual machine."
},
"defaultValue": false
}
},
"variables": {
"emptyArray": [],
"domain": "[if(equals(parameters('domain'), ''), last(split(parameters('administratorAccountUsername'), '@')), parameters('domain'))]",
"storageAccountType": "[parameters('rdshVMDiskType')]",
"newNsgName": "[concat(parameters('rdshPrefix'), 'nsg-', parameters('_guidValue'))]",
"newNsgDeploymentName": "[concat('NSG-linkedTemplate-', parameters('_guidValue'))]",
"nsgId": "[if(parameters('createNetworkSecurityGroup'), resourceId('Microsoft.Network/networkSecurityGroups', variables('newNsgName')), parameters('networkSecurityGroupId'))]",
"isVMAdminAccountCredentialsProvided": "[and(not(equals(parameters('vmAdministratorAccountUsername'), '')), not(equals(parameters('vmAdministratorAccountPassword'), '')))]",
"vmAdministratorUsername": "[if(variables('isVMAdminAccountCredentialsProvided'), parameters('vmAdministratorAccountUsername'), first(split(parameters('administratorAccountUsername'), '@')))]",
"vmAdministratorPassword": "[if(variables('isVMAdminAccountCredentialsProvided'), parameters('vmAdministratorAccountPassword'), parameters('administratorAccountPassword'))]",
"vmAvailabilitySetResourceId": { "id": "[resourceId('Microsoft.Compute/availabilitySets/', parameters('availabilitySetName'))]" },
"planInfoEmpty": "[or(empty(parameters('vmGalleryImageSKU')), empty(parameters('vmGalleryImagePublisher')), empty(parameters('vmGalleryImageOffer')))]",
"marketplacePlan": {
"name": "[parameters('vmGalleryImageSKU')]",
"publisher": "[parameters('vmGalleryImagePublisher')]",
"product": "[parameters('vmGalleryImageOffer')]"
},
"vmPlan": "[if(or(variables('planInfoEmpty'), not(parameters('vmGalleryImageHasPlan'))), json('null'), variables('marketplacePlan'))]",
"vmIdentityType": "[if(parameters('aadJoin'), if(not(empty(parameters('userAssignedIdentity'))), 'SystemAssigned, UserAssigned', 'SystemAssigned'), if(not(empty(parameters('userAssignedIdentity'))), 'UserAssigned', 'None'))]",
"vmIdentityTypeProperty": {
"type": "[variables('vmIdentityType')]"
},
"vmUserAssignedIdentityProperty": {
"userAssignedIdentities": {
"[resourceID('Microsoft.ManagedIdentity/userAssignedIdentities/',parameters('userAssignedIdentity'))]": {}
}
},
"vmIdentity": "[if(not(empty(parameters('userAssignedIdentity'))), union(variables('vmIdentityTypeProperty'), variables('vmUserAssignedIdentityProperty')), variables('vmIdentityTypeProperty'))]",
"postDeploymentCustomConfigurationTemplateProperty": {
"mode": "Incremental",
"templateLink": {
"uri": "[parameters('customConfigurationTemplateUrl')]",
"contentVersion": "1.0.0.0"
}
},
"postDeploymentCustomConfigurationParameterProperty": {
"parametersLink": {
"uri": "[parameters('customConfigurationParameterUrl')]"
}
},
"customConfigurationParameter": "[if(empty(parameters('customConfigurationParameterUrl')), variables('postDeploymentCustomConfigurationTemplateProperty'), union(variables('postDeploymentCustomConfigurationTemplateProperty'), variables('postDeploymentCustomConfigurationParameterProperty')))]",
"securityProfile": {
"uefiSettings": {
"secureBootEnabled": "[parameters('secureBoot')]",
"vTpmEnabled": "[parameters('vTPM')]"
},
"securityType": "[parameters('securityType')]"
}
},
"resources": [
{
"apiVersion": "2018-05-01",
"name": "[variables('newNsgDeploymentName')]",
"type": "Microsoft.Resources/deployments",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"condition": "[parameters('createNetworkSecurityGroup')]",
"type": "Microsoft.Network/networkSecurityGroups",
"apiVersion": "2019-02-01",
"name": "[variables('newNsgName')]",
"location": "[parameters('location')]",
"tags": "[parameters('networkSecurityGroupTags')]",
"properties": {
"securityRules": "[parameters('networkSecurityGroupRules')]"
}
}
]
}
}
},
{
"apiVersion": "2018-11-01",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(parameters('rdshPrefix'), add(copyindex(), parameters('vmInitialNumber')), '-nic')]",
"location": "[parameters('location')]",
"tags": "[parameters('networkInterfaceTags')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[parameters('subnet-id')]"
}
}
}
],
"enableAcceleratedNetworking": "[parameters('enableAcceleratedNetworking')]",
"networkSecurityGroup": "[if(empty(parameters('networkSecurityGroupId')), json('null'), json(concat('{\"id\": \"', variables('nsgId'), '\"}')))]"
},
"dependsOn": [
"[variables('newNsgDeploymentName')]"
]
},
{
"apiVersion": "2021-07-01",
"type": "Microsoft.Compute/virtualMachines",
"name": "[concat(parameters('rdshPrefix'), add(copyindex(), parameters('vmInitialNumber')))]",
"location": "[parameters('location')]",
"tags": "[parameters('virtualMachineTags')]",
"plan": "[variables('vmPlan')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('rdshPrefix'), add(copyindex(), parameters('vmInitialNumber')), '-nic')]"
],
"identity": "[variables('vmIdentity')]",
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('rdshVmSize')]"
},
"availabilitySet": "[if(equals(parameters('availabilityOption'), 'AvailabilitySet'), variables('vmAvailabilitySetResourceId'), json('null'))]",
"osProfile": {
"computerName": "[concat(parameters('rdshPrefix'), add(copyindex(), parameters('vmInitialNumber')))]",
"adminUsername": "[variables('vmAdministratorUsername')]",
"adminPassword": "[variables('vmAdministratorPassword')]"
},
"securityProfile": "[if(equals(parameters('securityType'), 'TrustedLaunch'), variables('securityProfile'), json('null'))]",
"storageProfile": {
"imageReference": {
"publisher": "[parameters('vmGalleryImagePublisher')]",
"offer": "[parameters('vmGalleryImageOffer')]",
"sku": "[parameters('vmGalleryImageSKU')]",
"version": "[if(empty(parameters('vmGalleryImageVersion')), 'latest', parameters('vmGalleryImageVersion'))]"
},
"osDisk": {
"createOption": "FromImage",
"diskSizeGB": "[if(equals(parameters('rdshVmDiskSizeGB'), 0), json('null'), parameters('rdshVmDiskSizeGB'))]",
"managedDisk": {
"storageAccountType": "[variables('storageAccountType')]"
}
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(parameters('rdshPrefix'), add(copyindex(), parameters('vmInitialNumber')), '-nic'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": "[parameters('bootDiagnostics')]"
},
"additionalCapabilities": {
"hibernationEnabled": "[parameters('rdshHibernate')]"
},
"licenseType": "Windows_Client"
},
"zones": "[if(equals(parameters('availabilityOption'), 'AvailabilityZone'), array(parameters('availabilityZone')), variables('emptyArray'))]"
},
{
"type": "Microsoft.Compute/virtualMachines/extensions",
"apiVersion": "2021-04-01",
"name": "[concat(parameters('rdshPrefix'), add(copyindex(), parameters('vmInitialNumber')),'/', 'InstallAutomationScripts')]",
"location": "[parameters('location')]",
"dependsOn": [
"[resourceId('Microsoft.Compute/virtualMachines/', concat(parameters('rdshPrefix'), add(copyindex(), parameters('vmInitialNumber'))))]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.7",
"autoUpgradeMinorVersion": true,
"settings": {
"commandToExecute": "powershell.exe Invoke-WebRequest -Uri 'https://aka.ms/vscode-win32-x64-system-stable' -OutFile 'c:\\windows\\temp\\VSCode_x64.exe' && powershell.exe Start-Sleep -Seconds 10 && powershell.exe Start-Process -FilePath 'c:\\windows\\temp\\VSCode_x64.exe' -Args '/verysilent /suppressmsgboxes /mergetasks=!runcode' -Wait -PassThru"
}
}
}
],
"outputs": {}
}