@@ -257,14 +257,315 @@ You can delete an empty Hybrid Runbook Worker group from the portal.
257
257
258
258
The hybrid worker group will be deleted.
259
259
260
- ## Use Azure Resource Manager template
260
+ ## Install Hybrid worker extension
261
+
262
+ #### [ Using ARM template] ( #tab/arm-template )
263
+
264
+ You can use an Azure Resource Manager (ARM) template to create a new Azure Windows VM and connect it to an existing Automation account and Hybrid Worker Group. To learn more about ARM templates, see [ What are ARM templates?] ( ../azure-resource-manager/templates/overview.md )
265
+
266
+ ** Review the template**
267
+
268
+ ``` json
269
+ {
270
+ "$schema" : " https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#" ,
271
+ "contentVersion" : " 1.0.0.0" ,
272
+ "parameters" : {
273
+ "automationAccount" : {
274
+ "type" : " string"
275
+ },
276
+ "automationAccountLocation" : {
277
+ "type" : " string"
278
+ },
279
+ "workerGroupName" : {
280
+ "type" : " string"
281
+ },
282
+ "virtualMachineName" : {
283
+ "type" : " string" ,
284
+ "defaultValue" : " simple-vm" ,
285
+ "metadata" : {
286
+ "description" : " Name of the virtual machine."
287
+ }
288
+ },
289
+ "adminUsername" : {
290
+ "type" : " string" ,
291
+ "metadata" : {
292
+ "description" : " Username for the Virtual Machine."
293
+ }
294
+ },
295
+ "adminPassword" : {
296
+ "type" : " securestring" ,
297
+ "minLength" : 12 ,
298
+ "metadata" : {
299
+ "description" : " Password for the Virtual Machine."
300
+ }
301
+ },
302
+ "vmLocation" : {
303
+ "type" : " string" ,
304
+ "defaultValue" : " North Central US" ,
305
+ "metadata" : {
306
+ "description" : " Location for the VM."
307
+ }
308
+ },
309
+ "vmSize" : {
310
+ "type" : " string" ,
311
+ "defaultValue" : " Standard_DS1_v2" ,
312
+ "metadata" : {
313
+ "description" : " Size of the virtual machine."
314
+ }
315
+ },
316
+ "osVersion" : {
317
+ "type" : " string" ,
318
+ "defaultValue" : " 2019-Datacenter" ,
319
+ "allowedValues" : [
320
+ " 2008-R2-SP1" ,
321
+ " 2012-Datacenter" ,
322
+ " 2012-R2-Datacenter" ,
323
+ " 2016-Nano-Server" ,
324
+ " 2016-Datacenter-with-Containers" ,
325
+ " 2016-Datacenter" ,
326
+ " 2019-Datacenter" ,
327
+ " 2019-Datacenter-Core" ,
328
+ " 2019-Datacenter-Core-smalldisk" ,
329
+ " 2019-Datacenter-Core-with-Containers" ,
330
+ " 2019-Datacenter-Core-with-Containers-smalldisk" ,
331
+ " 2019-Datacenter-smalldisk" ,
332
+ " 2019-Datacenter-with-Containers" ,
333
+ " 2019-Datacenter-with-Containers-smalldisk"
334
+ ],
335
+ "metadata" : {
336
+ "description" : " The Windows version for the VM. This will pick a fully patched image of this given Windows version."
337
+ }
338
+ },
339
+ "dnsNameForPublicIP" : {
340
+ "type" : " string" ,
341
+ "metadata" : {
342
+ "description" : " DNS name for the public IP"
343
+ }
344
+ },
345
+ "_CurrentDateTimeInTicks" : {
346
+ "type" : " string" ,
347
+ "defaultValue" : " [utcNow('yyyy-MM-dd')]"
348
+ }
349
+ },
350
+ "variables" : {
351
+ "nicName" : " myVMNict" ,
352
+ "addressPrefix" : " 10.0.0.0/16" ,
353
+ "subnetName" : " Subnet" ,
354
+ "subnetPrefix" : " 10.0.0.0/24" ,
355
+ "subnetRef" : " [resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]" ,
356
+ "vmName" : " [parameters('virtualMachineName')]" ,
357
+ "virtualNetworkName" : " MyVNETt" ,
358
+ "publicIPAddressName" : " myPublicIPt" ,
359
+ "networkSecurityGroupName" : " default-NSGt" ,
360
+ "UniqueStringBasedOnTimeStamp" : " [uniqueString(deployment().name, parameters('_CurrentDateTimeInTicks'))]"
361
+ },
362
+ "resources" : [
363
+ {
364
+ "apiVersion" : " 2020-08-01" ,
365
+ "type" : " Microsoft.Network/publicIPAddresses" ,
366
+ "name" : " [variables('publicIPAddressName')]" ,
367
+ "location" : " [parameters('vmLocation')]" ,
368
+ "properties" : {
369
+ "publicIPAllocationMethod" : " Dynamic" ,
370
+ "dnsSettings" : {
371
+ "domainNameLabel" : " [parameters('dnsNameForPublicIP')]"
372
+ }
373
+ }
374
+ },
375
+ {
376
+ "comments" : " Default Network Security Group for template" ,
377
+ "type" : " Microsoft.Network/networkSecurityGroups" ,
378
+ "apiVersion" : " 2020-08-01" ,
379
+ "name" : " [variables('networkSecurityGroupName')]" ,
380
+ "location" : " [parameters('vmLocation')]" ,
381
+ "properties" : {
382
+ "securityRules" : [
383
+ {
384
+ "name" : " default-allow-3389" ,
385
+ "properties" : {
386
+ "priority" : 1000 ,
387
+ "access" : " Allow" ,
388
+ "direction" : " Inbound" ,
389
+ "destinationPortRange" : " 3389" ,
390
+ "protocol" : " Tcp" ,
391
+ "sourceAddressPrefix" : " *" ,
392
+ "sourcePortRange" : " *" ,
393
+ "destinationAddressPrefix" : " *"
394
+ }
395
+ }
396
+ ]
397
+ }
398
+ },
399
+ {
400
+ "apiVersion" : " 2020-08-01" ,
401
+ "type" : " Microsoft.Network/virtualNetworks" ,
402
+ "name" : " [variables('virtualNetworkName')]" ,
403
+ "location" : " [parameters('vmLocation')]" ,
404
+ "dependsOn" : [
405
+ " [resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
406
+ ],
407
+ "properties" : {
408
+ "addressSpace" : {
409
+ "addressPrefixes" : [
410
+ " [variables('addressPrefix')]"
411
+ ]
412
+ },
413
+ "subnets" : [
414
+ {
415
+ "name" : " [variables('subnetName')]" ,
416
+ "properties" : {
417
+ "addressPrefix" : " [variables('subnetPrefix')]" ,
418
+ "networkSecurityGroup" : {
419
+ "id" : " [resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
420
+ }
421
+ }
422
+ }
423
+ ]
424
+ }
425
+ },
426
+ {
427
+ "apiVersion" : " 2020-08-01" ,
428
+ "type" : " Microsoft.Network/networkInterfaces" ,
429
+ "name" : " [variables('nicName')]" ,
430
+ "location" : " [parameters('vmLocation')]" ,
431
+ "dependsOn" : [
432
+ " [variables('publicIPAddressName')]" ,
433
+ " [variables('virtualNetworkName')]"
434
+ ],
435
+ "properties" : {
436
+ "ipConfigurations" : [
437
+ {
438
+ "name" : " ipconfig1" ,
439
+ "properties" : {
440
+ "privateIPAllocationMethod" : " Dynamic" ,
441
+ "publicIPAddress" : {
442
+ "id" : " [resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
443
+ },
444
+ "subnet" : {
445
+ "id" : " [variables('subnetRef')]"
446
+ }
447
+ }
448
+ }
449
+ ]
450
+ }
451
+ },
452
+ {
453
+ "apiVersion" : " 2020-12-01" ,
454
+ "type" : " Microsoft.Compute/virtualMachines" ,
455
+ "name" : " [variables('vmName')]" ,
456
+ "location" : " [parameters('vmLocation')]" ,
457
+ "dependsOn" : [
458
+ " [variables('nicName')]"
459
+ ],
460
+ "identity" : {
461
+ "type" : " SystemAssigned"
462
+ } ,
463
+ "properties" : {
464
+ "hardwareProfile" : {
465
+ "vmSize" : " [parameters('vmSize')]"
466
+ },
467
+ "osProfile" : {
468
+ "computerName" : " [variables('vmName')]" ,
469
+ "adminUsername" : " [parameters('adminUsername')]" ,
470
+ "adminPassword" : " [parameters('adminPassword')]"
471
+ },
472
+ "storageProfile" : {
473
+ "imageReference" : {
474
+ "publisher" : " MicrosoftWindowsServer" ,
475
+ "offer" : " WindowsServer" ,
476
+ "sku" : " [parameters('osVersion')]" ,
477
+ "version" : " latest"
478
+ },
479
+ "osDisk" : {
480
+ "createOption" : " FromImage"
481
+ }
482
+ },
483
+ "networkProfile" : {
484
+ "networkInterfaces" : [
485
+ {
486
+ "id" : " [resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
487
+ }
488
+ ]
489
+ }
490
+ }
491
+ },
492
+ {
493
+ "type" : " Microsoft.Automation/automationAccounts" ,
494
+ "apiVersion" : " 2021-06-22" ,
495
+ "name" : " [parameters('automationAccount')]" ,
496
+ "location" : " [parameters('automationAccountLocation')]" ,
497
+ "properties" : {
498
+ "sku" : {
499
+ "name" : " Basic"
500
+ }
501
+ },
502
+ "resources" : [
503
+ {
504
+ "name" : " [concat(parameters('workerGroupName'),'/',guid('AzureAutomationJobName', variables('UniqueStringBasedOnTimeStamp')))]" ,
505
+ "type" : " hybridRunbookWorkerGroups/hybridRunbookWorkers" ,
506
+ "apiVersion" : " 2021-06-22" ,
507
+ "dependsOn" : [
508
+ " [resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccount'))]" ,
509
+ " [resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))]"
510
+ ],
511
+ "properties" : {
512
+ "vmResourceId" : " [resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]"
513
+ }
514
+ }
515
+ ]
516
+ },
517
+ {
518
+ "type" : " Microsoft.Compute/virtualMachines/extensions" ,
519
+ "name" : " [concat(parameters('virtualMachineName'),'/HybridWorkerExtension')]" ,
520
+ "apiVersion" : " 2020-12-01" ,
521
+ "location" : " [parameters('vmLocation')]" ,
522
+ "dependsOn" : [
523
+ " [resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccount'))]" ,
524
+ " [resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachineName'))]"
525
+ ],
526
+ "properties" : {
527
+ "publisher" : " Microsoft.Azure.Automation.HybridWorker" ,
528
+ "type" : " HybridWorkerForWindows" ,
529
+ "typeHandlerVersion" : " 0.1" ,
530
+ "autoUpgradeMinorVersion" : true ,
531
+ "settings" : {
532
+ "AutomationAccountURL" : " [reference(resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccount'))).AutomationHybridServiceUrl]"
533
+ }
534
+ }
535
+ }
536
+ ],
537
+ "outputs" : {
538
+ "output1" : {
539
+ "type" : " string" ,
540
+ "value" : " [reference(resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccount'))).AutomationHybridServiceUrl]"
541
+ }
542
+ }
543
+ }
544
+ ```
261
545
262
- You can use an [ Azure Resource Manager (ARM) template ] ( ./use-azure-resource-manager-template.md ) to create a new Azure Windows VM and connect it to the existing Automation account and Hybrid Worker Group.
546
+ The following Azure resources are defined in the template:
263
547
548
+ - [ hybridRunbookWorkerGroups/hybridRunbookWorkers] ( /azure/templates/microsoft.automation/automationaccounts/hybridrunbookworkergroups/hybridrunbookworkers )
549
+ - [ Microsoft.Compute/virtualMachines/extensions] ( /azure/templates/microsoft.compute/virtualmachines/extensions )
264
550
265
- ## Install Hybrid worker extension
551
+ ** Review parameters **
266
552
553
+ Review the parameters used in this template.
267
554
555
+ | Property | Description |
556
+ | --- | --- |
557
+ | automationAccount | The name of the existing Automation account. |
558
+ | automationAccountLocation | The region of the existing Automation account. |
559
+ | workerGroupName | The name of the existing Hybrid Worker Group. |
560
+ | virtualMachineName | The name for the VM to be created. The default value is ` simple-vm ` . |
561
+ | adminUsername | The VM admin user name. |
562
+ | adminPassword | The VM admin password. |
563
+ | vmLocation | The region for the new VM. The default value is ` North Central US ` . |
564
+ | vmSize | The size for the new VM. The default value is ` Standard_DS1_v2 ` . |
565
+ | osVersion | The OS for the new Windows VM. The default value is ` 2019-Datacenter ` . |
566
+ | dnsNameForPublicIP | The DNS name for the public IP. |
567
+
568
+
268
569
#### [ Using REST API] ( #tab/rest-api )
269
570
270
571
** Prerequisites**
@@ -377,7 +678,7 @@ To install and use Hybrid Worker extension using REST API, follow these steps. T
377
678
```
378
679
Response of the *PUT* call will confirm if the extension is successfully installed or not on the targeted VM. You can also go to the VM in the Azure portal, and check status of extensions installed on the target VM under **Extensions** tab.
379
680
380
- #### [Using CLI](#tab/cli)
681
+ #### [Using Azure CLI](#tab/cli)
381
682
382
683
**Manage Hybrid Worker Extension**
383
684
0 commit comments