forked from helderpinto/AzureOptimizationEngine
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azuredeploy.json
1849 lines (1849 loc) · 90.5 KB
/
azuredeploy.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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"projectLocation": {
"type": "String"
},
"_artifactsLocation": {
"type": "string",
"defaultValue": "[deployment().properties.templateLink.uri]",
"metadata": {
"description": "The base URI where artifacts required by this template are located"
}
},
"artifactsLocationSasToken": {
"type": "securestring",
"defaultValue": "",
"metadata": {
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be grabbed from parameters."
}
},
"storageAccountName": {
"type": "String"
},
"automationAccountName": {
"type": "String"
},
"sqlServerName": {
"type": "String"
},
"sqlDatabaseName": {
"type": "String",
"defaultValue": "azureoptimization"
},
"logAnalyticsReuse": {
"type": "bool"
},
"logAnalyticsWorkspaceName": {
"type": "String"
},
"logAnalyticsWorkspaceRG": {
"type": "String"
},
"logAnalyticsRetentionDays": {
"type": "int",
"defaultValue": 120
},
"sqlBackupRetentionDays": {
"type": "int",
"defaultValue": 14
},
"sqlAdminLogin": {
"type": "String"
},
"sqlAdminPassword": {
"type": "securestring"
},
"cloudEnvironment": {
"type": "String",
"defaultValue": "AzureCloud"
},
"authenticationOption": {
"type": "String",
"defaultValue": "RunAsAccount"
},
"baseTime": {
"type": "string",
"defaultValue": "[utcNow('u')]",
"metadata": {
"description": "Base time for all automation runbook schedules."
}
},
"argDiskExportJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG Disk Export job schedule creation - create a unique before deploy"
}
},
"argVhdExportJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG VHD Export job schedule creation - create a unique before deploy"
}
},
"argVmExportJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG VM Export job schedule creation - create a unique before deploy"
}
},
"argAvailSetExportJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG Availability Set Export job schedule creation - create a unique before deploy"
}
},
"advisorExportJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Advisor Export job schedule creation - create a unique before deploy"
}
},
"consumptionExportJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Consumption Export job schedule creation - create a unique before deploy"
}
},
"argDiskIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG Disk Ingest job schedule creation - create a unique before deploy"
}
},
"argVhdIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG VHD Ingest job schedule creation - create a unique before deploy"
}
},
"argVmIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG VM Ingest job schedule creation - create a unique before deploy"
}
},
"argAvailSetIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the ARG Availability Set Ingest job schedule creation - create a unique before deploy"
}
},
"advisorIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Advisor Ingest job schedule creation - create a unique before deploy"
}
},
"remediationLogsIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Remediation Logs Ingest job schedule creation - create a unique before deploy"
}
},
"consumptionIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Consumption Ingest job schedule creation - create a unique before deploy"
}
},
"unattachedDisksRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Unattached Disks Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"advisorCostAugmentedRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Augmented Advisor Cost Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"advisorAsIsRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Advisor General Recommendations Generation job schedule creation - create a unique before deploy"
}
},
"unmanagedDisksRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Unmanaged Disks Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"availSetsLowFaultDomainRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Availability Sets with Low Fault Domains Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"availSetsLowUpdateDomainRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Availability Sets with Low Update Domains Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"availSetsSharingStorageRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Availability Sets with VMs Sharing Storage Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"longDeallocatedVmsRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Long Deallocated VMs Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"storageAccountsMultipleVmsRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Storage Accounts with Multiple VMs Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"vmsNoAvailSetRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the VMs without Availability Set Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"vmsSingleInAvailSetRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the VMs single in Availability Set Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"vmsDisksMultipleStorageRecommendationJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the VMs with Disks in Multiple Storage Accounts Recommendation Generation job schedule creation - create a unique before deploy"
}
},
"recommendationsIngestJobId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "GUID for the Recommendations Ingest job schedule creation - create a unique before deploy"
}
}
},
"variables": {
"advisorContainerName": "advisorexports",
"argVmContainerName": "argvmexports",
"argDiskContainerName": "argdiskexports",
"argVhdContainerName": "argvhdexports",
"argAvailSetContainerName": "argavailsetexports",
"consumptionContainerName": "consumptionexports",
"recommendationsContainerName": "recommendationsexports",
"remediationLogsContainerName": "remediationlogs",
"advisorExportsRunbookName": "Export-AdvisorRecommendationsToBlobStorage",
"argVmExportsRunbookName": "Export-ARGVirtualMachinesPropertiesToBlobStorage",
"argDisksExportsRunbookName": "Export-ARGManagedDisksPropertiesToBlobStorage",
"argVhdExportsRunbookName": "Export-ARGUnmanagedDisksPropertiesToBlobStorage",
"argAvailSetExportsRunbookName": "Export-ARGAvailabilitySetPropertiesToBlobStorage",
"consumptionExportsRunbookName": "Export-ConsumptionToBlobStorage",
"csvIngestRunbookName": "Ingest-OptimizationCSVExportsToLogAnalytics",
"unattachedDisksRecommendationsRunbookName": "Recommend-UnattachedDisksToBlobStorage",
"advisorCostAugmentedRecommendationsRunbookName": "Recommend-AdvisorCostAugmentedToBlobStorage",
"advisorAsIsRecommendationsRunbookName": "Recommend-AdvisorAsIsToBlobStorage",
"unmanagedDisksRecommendationsRunbookName": "Recommend-VMsWithUnmanagedDisksToBlobStorage",
"availSetsLowFaultDomainRecommendationsRunbookName": "Recommend-AvailSetsWithLowFaultDomainCountToBlobStorage",
"availSetsLowUpdateDomainRecommendationsRunbookName": "Recommend-AvailSetsWithLowUpdateDomainCountToBlobStorage",
"availSetsSharingStorageRecommendationsRunbookName": "Recommend-AvailSetsWithVMsSharingStorageAccountsToBlobStorage",
"longDeallocatedVmsRecommendationsRunbookName": "Recommend-LongDeallocatedVmsToBlobStorage",
"storageAccountsMultipleVmsRecommendationsRunbookName": "Recommend-StorageAccountsWithMultipleVMsToBlobStorage",
"vmsNoAvailSetRecommendationsRunbookName": "Recommend-VMsNoAvailSetToBlobStorage",
"vmsSingleInAvailSetRecommendationsRunbookName": "Recommend-VMsSingleInAvailSetToBlobStorage",
"vmsDisksMultipleStorageRecommendationsRunbookName": "Recommend-VMsWithDisksMultipleStorageAccountsToBlobStorage",
"recommendationsIngestRunbookName": "Ingest-RecommendationsToSQLServer",
"advisorRightSizeFilteredRemediationRunbookName": "Remediate-AdvisorRightSizeFiltered",
"advisorExportsScheduleName": "AzureOptimization_ExportAdvisorWeekly",
"argExportsScheduleName": "AzureOptimization_ExportARGDaily",
"consumptionExportsScheduleName": "AzureOptimization_ExportConsumptionDaily",
"argDiskIngestScheduleName": "AzureOptimization_IngestARGDisksDaily",
"argVhdIngestScheduleName": "AzureOptimization_IngestARGVHDsDaily",
"argVmIngestScheduleName": "AzureOptimization_IngestARGVMsDaily",
"argAvailSetIngestScheduleName": "AzureOptimization_IngestARGAvailSetsDaily",
"remediationLogsIngestScheduleName": "AzureOptimization_IngestRemediationLogsDaily",
"consumptionIngestScheduleName": "AzureOptimization_IngestConsumptionDaily",
"advisorIngestScheduleName": "AzureOptimization_IngestAdvisorWeekly",
"recommendationsScheduleName": "AzureOptimization_RecommendationsWeekly",
"recommendationsIngestScheduleName": "AzureOptimization_IngestRecommendationsWeekly",
"apiVersions": {
"operationalInsights": "2020-03-01-preview",
"automation": "2018-06-30",
"storage": "2019-06-01",
"sql": "2019-06-01-preview"
},
"Az.Accounts": {
"name": "Az.Accounts",
"url": "https://www.powershellgallery.com/api/v2/package/Az.Accounts/2.2.1"
},
"psModules": [
{
"name": "Az.Advisor",
"url": "https://www.powershellgallery.com/api/v2/package/Az.Advisor/1.1.1"
},
{
"name": "Az.Billing",
"url": "https://www.powershellgallery.com/api/v2/package/Az.Billing/2.0.0"
},
{
"name": "Az.Compute",
"url": "https://www.powershellgallery.com/api/v2/package/Az.Compute/4.6.0"
},
{
"name": "Az.OperationalInsights",
"url": "https://www.powershellgallery.com/api/v2/package/Az.OperationalInsights/2.3.0"
},
{
"name": "Az.ResourceGraph",
"url": "https://www.powershellgallery.com/api/v2/package/Az.ResourceGraph/0.7.7"
},
{
"name": "Az.Storage",
"url": "https://www.powershellgallery.com/api/v2/package/Az.Storage/3.0.0"
}
],
"runbooks": [
{
"name": "[variables('advisorExportsRunbookName')]",
"version": "1.2.1.0",
"description": "Exports Azure Advisor recommendations to Blob Storage using the Advisor API",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/data-collection/',variables('advisorExportsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('argDisksExportsRunbookName')]",
"version": "1.2.1.0",
"description": "Exports Managed Disks properties to Blob Storage using Azure Resource Graph",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/data-collection/',variables('argDisksExportsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('argVhdExportsRunbookName')]",
"version": "1.0.0.0",
"description": "Exports Unmanaged Disks (owned by a VM) properties to Blob Storage using Azure Resource Graph",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/data-collection/',variables('argVhdExportsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('argVmExportsRunbookName')]",
"version": "1.3.1.0",
"description": "Exports Virtual Machine properties to Blob Storage using Azure Resource Graph",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/data-collection/',variables('argVmExportsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('argAvailSetExportsRunbookName')]",
"version": "1.0.0.0",
"description": "Exports Availability Set properties to Blob Storage using Azure Resource Graph",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/data-collection/',variables('argAvailSetExportsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('consumptionExportsRunbookName')]",
"version": "1.0.1.0",
"description": "Exports Azure Consumption events to Blob Storage using Azure Consumption API",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/data-collection/',variables('consumptionExportsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('csvIngestRunbookName')]",
"version": "1.4.0.0",
"description": "Ingests CSV blobs as custom logs to Log Analytics",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/data-collection/',variables('csvIngestRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('unattachedDisksRecommendationsRunbookName')]",
"version": "2.2.1.0",
"description": "Generates unattached disks recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('unattachedDisksRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('advisorCostAugmentedRecommendationsRunbookName')]",
"version": "2.2.1.0",
"description": "Generates augmented Advisor Cost recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('advisorCostAugmentedRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('advisorAsIsRecommendationsRunbookName')]",
"version": "1.1.1.0",
"description": "Generates all types of Advisor recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('advisorAsIsRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('unmanagedDisksRecommendationsRunbookName')]",
"version": "1.3.2.0",
"description": "Generates unmanaged disks recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('unmanagedDisksRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('availSetsLowFaultDomainRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates low fault domain Availability Set recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('availSetsLowFaultDomainRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('availSetsLowUpdateDomainRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates low update domain Availability Set recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('availSetsLowUpdateDomainRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('availSetsSharingStorageRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates Availability Set VMs sharing storage recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('availSetsSharingStorageRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('longDeallocatedVmsRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates long deallocated VMs recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('longDeallocatedVmsRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('storageAccountsMultipleVmsRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates storage accounts with multiple VMs recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('storageAccountsMultipleVmsRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('vmsNoAvailSetRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates VMs without Availability Set recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('vmsNoAvailSetRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('vmsSingleInAvailSetRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates VMs single in Availability Set recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('vmsSingleInAvailSetRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('vmsDisksMultipleStorageRecommendationsRunbookName')]",
"version": "1.0.1.0",
"description": "Generates VMs with disks in multiple storage accounts recommendations",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('vmsDisksMultipleStorageRecommendationsRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('recommendationsIngestRunbookName')]",
"version": "1.5.0.0",
"description": "Ingests JSON-based recommendations into an Azure SQL Database",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/recommendations/',variables('recommendationsIngestRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
},
{
"name": "[variables('advisorRightSizeFilteredRemediationRunbookName')]",
"version": "1.2.0.0",
"description": "Remediates Azure Advisor right-size recommendations given fit and tag filters",
"type": "PowerShell",
"scriptUri": "[uri(parameters('_artifactsLocation'), concat('runbooks/remediations/',variables('advisorRightSizeFilteredRemediationRunbookName'),'.ps1', parameters('artifactsLocationSasToken')))]"
}
],
"automationVariables": [
{
"name": "AzureOptimization_CloudEnvironment",
"description": "Azure Cloud environment (e.g., AzureCloud, AzureChinaCloud, etc.)",
"value": "[concat('\"',parameters('cloudEnvironment'),'\"')]"
},
{
"name": "AzureOptimization_AuthenticationOption",
"description": "Runbook authentication type (Run As Account or Managed Identity)",
"value": "[concat('\"',parameters('authenticationOption'),'\"')]"
},
{
"name": "AzureOptimization_StorageSink",
"description": "The Azure Storage Account where data source exports are dumped to",
"value": "[concat('\"',parameters('storageAccountName'),'\"')]"
},
{
"name": "AzureOptimization_StorageSinkRG",
"description": "The resource group for the Azure Storage Account sink",
"value": "[concat('\"',resourceGroup().name,'\"')]"
},
{
"name": "AzureOptimization_StorageSinkSubId",
"description": "The subscription Id for the Azure Storage Account sink",
"value": "[concat('\"',subscription().subscriptionId,'\"')]"
},
{
"name": "AzureOptimization_AdvisorContainer",
"description": "The Storage Account container where Azure Advisor exports are dumped to",
"value": "[concat('\"',variables('advisorContainerName'),'\"')]"
},
{
"name": "AzureOptimization_ARGDiskContainer",
"description": "The Storage Account container where Azure Resource Graph Managed Disks exports are dumped to",
"value": "[concat('\"',variables('argDiskContainerName'),'\"')]"
},
{
"name": "AzureOptimization_ARGVhdContainer",
"description": "The Storage Account container where Azure Resource Graph Unmanaged Disks exports are dumped to",
"value": "[concat('\"',variables('argVhdContainerName'),'\"')]"
},
{
"name": "AzureOptimization_ARGVMContainer",
"description": "The Storage Account container where Azure Resource Graph Virtual Machine exports are dumped to",
"value": "[concat('\"',variables('argVmContainerName'),'\"')]"
},
{
"name": "AzureOptimization_ARGAvailabilitySetContainer",
"description": "The Storage Account container where Azure Resource Graph Availability Set exports are dumped to",
"value": "[concat('\"',variables('argAvailSetContainerName'),'\"')]"
},
{
"name": "AzureOptimization_ConsumptionContainer",
"description": "The Storage Account container where Azure Consumption exports are dumped to",
"value": "[concat('\"',variables('consumptionContainerName'),'\"')]"
},
{
"name": "AzureOptimization_ConsumptionOffsetDays",
"description": "The offset (in days) for querying for consumption data",
"value": 7
},
{
"name": "AzureOptimization_RecommendationsContainer",
"description": "The Storage Account container where recommendations are dumped to",
"value": "[concat('\"',variables('recommendationsContainerName'),'\"')]"
},
{
"name": "AzureOptimization_RemediationLogsContainer",
"description": "The Storage Account container where remediation logs are dumped to",
"value": "[concat('\"',variables('remediationLogsContainerName'),'\"')]"
},
{
"name": "AzureOptimization_AdvisorFilter",
"description": "The category filter to use for Azure Advisor recommendations exports",
"value": "[concat('\"','all','\"')]"
},
{
"name": "AzureOptimization_ReferenceRegion",
"description": "The Azure region used as a reference for getting details about Azure VM sizes available",
"value": "[concat('\"',parameters('projectLocation'),'\"')]"
},
{
"name": "AzureOptimization_SQLServerDatabase",
"description": "The Azure SQL Database name for the ingestion control and recommendations tables",
"value": "[concat('\"',parameters('sqlDatabaseName'),'\"')]"
},
{
"name": "AzureOptimization_LogAnalyticsChunkSize",
"description": "The size (in rows) for each chunk of Log Analytics ingestion request",
"value": 10000
},
{
"name": "AzureOptimization_StorageBlobsPageSize",
"description": "The size (in blobs count) for each page of Storage Account container blob listing",
"value": 1000
},
{
"name": "AzureOptimization_SQLServerInsertSize",
"description": "The size (in inserted lines) for each page of recommendations ingestion into the SQL Database",
"value": 900
},
{
"name": "AzureOptimization_LogAnalyticsLogPrefix",
"description": "The prefix for all Azure Optimization custom log tables in Log Analytics",
"value": "[concat('\"','AzureOptimization','\"')]"
},
{
"name": "AzureOptimization_LogAnalyticsWorkspaceName",
"description": "The Log Analytics Workspace Name where optimization data will be ingested",
"value": "[concat('\"', parameters('logAnalyticsWorkspaceName'), '\"')]"
},
{
"name": "AzureOptimization_LogAnalyticsWorkspaceRG",
"description": "The resource group for the Log Analytics Workspace where optimization data will be ingested",
"value": "[concat('\"', if(not(parameters('logAnalyticsReuse')), resourceGroup().name, parameters('logAnalyticsWorkspaceRG')), '\"')]"
},
{
"name": "AzureOptimization_LogAnalyticsWorkspaceSubId",
"description": "The Azure subscription for the Log Analytics Workspace where optimization data will be ingested",
"value": "[concat('\"', subscription().subscriptionId, '\"')]"
},
{
"name": "AzureOptimization_LogAnalyticsWorkspaceTenantId",
"description": "The Azure AD tenant for the Log Analytics Workspace where optimization data will be ingested",
"value": "[concat('\"', subscription().tenantId, '\"')]"
},
{
"name": "AzureOptimization_RecommendAdvisorPeriodInDays",
"description": "The period (in days) to look back for Advisor exported recommendations",
"value": 7
},
{
"name": "AzureOptimization_RecommendationLongDeallocatedVmsIntervalDays",
"description": "The period (in days) for considering a VM long deallocated",
"value": 30
},
{
"name": "AzureOptimization_PerfPercentileCpu",
"description": "The percentile to be used for processor metrics",
"value": 99
},
{
"name": "AzureOptimization_PerfPercentileMemory",
"description": "The percentile to be used for memory metrics",
"value": 99
},
{
"name": "AzureOptimization_PerfPercentileNetwork",
"description": "The percentile to be used for network metrics",
"value": 99
},
{
"name": "AzureOptimization_PerfPercentileDisk",
"description": "The percentile to be used for disk metrics",
"value": 99
},
{
"name": "AzureOptimization_PerfThresholdCpuPercentage",
"description": "The processor usage percentage threshold above which the fit score is decreased",
"value": 30
},
{
"name": "AzureOptimization_PerfThresholdMemoryPercentage",
"description": "The memory usage percentage threshold above which the fit score is decreased",
"value": 50
},
{
"name": "AzureOptimization_PerfThresholdNetworkMbps",
"description": "The network usage threshold (in Mbps) above which the fit score is decreased",
"value": 750
},
{
"name": "AzureOptimization_PerfThresholdCpuShutdownPercentage",
"description": "The processor usage percentage threshold above which the fit score is decreased (shutdown scenarios)",
"value": 5
},
{
"name": "AzureOptimization_PerfThresholdMemoryShutdownPercentage",
"description": "The memory usage percentage threshold above which the fit score is decreased (shutdown scenarios)",
"value": 100
},
{
"name": "AzureOptimization_PerfThresholdNetworkShutdownMbps",
"description": "The network usage threshold (in Mbps) above which the fit score is decreased (shutdown scenarios)",
"value": 10
},
{
"name": "AzureOptimization_RemediateRightSizeMinFitScore",
"description": "The minimum fit score for right-size remediation",
"value": "[concat('\"','5.0','\"')]"
},
{
"name": "AzureOptimization_RemediateRightSizeMinWeeksInARow",
"description": "The minimum number of weeks in a row required for a right-size recommendation to be remediated",
"value": 4
},
{
"name": "AzureOptimization_RecommendationAdvisorCostRightSizeId",
"description": "The Azure Advisor VM right-size recommendation ID",
"value": "[concat('\"','e10b1381-5f0a-47ff-8c7b-37bd13d7c974','\"')]"
}
]
},
"resources": [
// Log Analytics Workspace
{
"condition": "[not(parameters('logAnalyticsReuse'))]",
"type": "microsoft.operationalinsights/workspaces",
"apiVersion": "[variables('apiVersions').operationalInsights]",
"name": "[parameters('logAnalyticsWorkspaceName')]",
"location": "[parameters('projectLocation')]",
"properties": {
"sku": {
"name": "pergb2018"
},
"retentionInDays": "[parameters('logAnalyticsRetentionDays')]"
}
},
// Storage Account
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[parameters('storageAccountName')]",
"location": "[parameters('projectLocation')]",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "StorageV2",
"properties": {
"networkAcls": {
"bypass": "AzureServices",
"virtualNetworkRules": [
],
"ipRules": [
],
"defaultAction": "Allow"
},
"supportsHttpsTrafficOnly": true,
"encryption": {
"services": {
"file": {
"enabled": true
},
"blob": {
"enabled": true
}
},
"keySource": "Microsoft.Storage"
},
"accessTier": "Cool"
}
},
// Storage Account Blob Services
{
"type": "Microsoft.Storage/storageAccounts/blobServices",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"sku": {
"name": "Standard_LRS"
},
"properties": {
"cors": {
"corsRules": [
]
},
"deleteRetentionPolicy": {
"enabled": false
}
}
},
// Storage Account ARG Disk exports container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('argDiskContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Storage Account ARG VHD exports container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('argVhdContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Storage Account ARG VM exports container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('argVmContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Storage Account ARG Availability Set exports container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('argAvailSetContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Storage Account Advisor exports container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('advisorContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Storage Account Consumption exports container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('consumptionContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Storage Account Recommendations exports container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('recommendationsContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Storage Account Remediations logs container
{
"type": "Microsoft.Storage/storageAccounts/blobServices/containers",
"apiVersion": "[variables('apiVersions').storage]",
"name": "[concat(parameters('storageAccountName'), '/default/', variables('remediationLogsContainerName'))]",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts/blobServices', parameters('storageAccountName'), 'default')]",
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
],
"properties": {
"publicAccess": "None"
}
},
// Azure SQL Server
{
"type": "Microsoft.Sql/servers",
"apiVersion": "[variables('apiVersions').sql]",
"name": "[parameters('sqlServerName')]",
"location": "[parameters('projectLocation')]",
"kind": "v12.0",
"properties": {
"administratorLogin": "[parameters('sqlAdminLogin')]",
"administratorLoginPassword": "[parameters('sqlAdminPassword')]",
"version": "12.0",
"publicNetworkAccess": "Enabled"
},
"resources": [
{
"type": "firewallRules",
"apiVersion": "[variables('apiVersions').sql]",
"name": "AllowAllWindowsAzureIps",
"location": "[parameters('projectLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
],
"properties": {
"endIpAddress": "0.0.0.0",
"startIpAddress": "0.0.0.0"
}
}
]
},
// Azure SQL Database
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "[variables('apiVersions').sql]",
"name": "[concat(parameters('sqlServerName'), '/', parameters('sqlDatabaseName'))]",
"location": "[parameters('projectLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
],
"sku": {
"name": "GP_S_Gen5",
"tier": "GeneralPurpose",
"family": "Gen5",
"capacity": 1
},
"kind": "v12.0,user,vcore,serverless",
"properties": {
"collation": "SQL_Latin1_General_CP1_CI_AS",
"maxSizeBytes": 3221225472,
"catalogCollation": "SQL_Latin1_General_CP1_CI_AS",
"zoneRedundant": false,
"readScale": "Disabled",
"readReplicaCount": 0,
"autoPauseDelay": 60,
"storageAccountType": "GRS",
"minCapacity": 0.5
}
},
// Azure SQL backup retention policy
{
"type": "Microsoft.Sql/servers/databases/backupShortTermRetentionPolicies",
"apiVersion": "[variables('apiVersions').sql]",
"name": "[concat(parameters('sqlServerName'), '/', parameters('sqlDatabaseName'), '/default')]",
"dependsOn": [
"[resourceId('Microsoft.Sql/servers/databases', parameters('sqlServerName'), parameters('sqlDatabaseName'))]",
"[resourceId('Microsoft.Sql/servers', parameters('sqlServerName'))]"
],
"properties": {
"retentionDays": "[parameters('sqlBackupRetentionDays')]"
}
},
// Automation Account
{
"type": "Microsoft.Automation/automationAccounts",
"apiVersion": "[variables('apiVersions').automation]",
"name": "[parameters('automationAccountName')]",
"location": "[parameters('projectLocation')]",
"properties": {
"sku": {
"name": "Basic"
}
}
},
// Automation Modules (Az.Account)
{
"comments": "provision the Az.Accounts module first since others are depenedent on it",
"name": "[concat(parameters('automationAccountName'), '/', variables('Az.Accounts').name)]",
"type": "Microsoft.Automation/automationAccounts/modules",
"apiVersion": "[variables('apiVersions').automation]",
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName'))]"
],
"properties": {
"contentLink": {
"uri": "[variables('Az.Accounts').url]"
}
}
},
// Automation Modules (other)
{
"name": "[concat(parameters('automationAccountName'), '/', variables('psModules')[copyIndex()].name)]",
"type": "Microsoft.Automation/automationAccounts/modules",
"apiVersion": "[variables('apiVersions').automation]",
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName'))]",
"[variables('Az.Accounts').name]"
],
"copy": {
"name": "modulesLoop",
"count": "[length(variables('psModules'))]"
},
"properties": {
"contentLink": {
"uri": "[variables('psModules')[copyIndex()].url]"
}
}
},
// Automation Runbooks
{
"name": "[concat(parameters('automationAccountName'), '/', variables('runbooks')[copyIndex()].name)]",
"type": "Microsoft.Automation/automationAccounts/runbooks",
"apiVersion": "[variables('apiVersions').automation]",
"location": "[parameters('projectLocation')]",
"dependsOn": [
"[resourceId('Microsoft.Automation/automationAccounts', parameters('automationAccountName'))]",
"[variables('Az.Accounts').name]",
"modulesLoop"
],
"copy": {
"name": "runbooksLoop",
"count": "[length(variables('runbooks'))]"
},
"properties": {
"runbookType": "[variables('runbooks')[copyIndex()].type]",
"logProgress": false,
"logVerbose": false,
"description": "[variables('runbooks')[copyIndex()].description]",
"publishContentLink": {
"uri": "[variables('runbooks')[copyIndex()].scriptUri]",
"version": "[variables('runbooks')[copyIndex()].version]"
}