Repository navigation
Expand file tree
/
Copy pathReliabilityWorkbookCompute.workbook
More file actions
1378 lines (1378 loc) · 255 KB
/
Copy pathReliabilityWorkbookCompute.workbook
File metadata and controls
1378 lines (1378 loc) · 255 KB
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
{
"version": "Notebook/1.0",
"items": [
{
"type": 9,
"content": {
"version": "KqlParameterItem/1.0",
"parameters": [
{
"id": "aa0176d8-14ff-4dc5-9ae7-b8029f565674",
"version": "KqlParameterItem/1.0",
"name": "Subscriptions",
"label": "Subscriptions",
"type": 6,
"isRequired": true,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"typeSettings": {
"additionalResourceOptions": [
"value::all"
],
"includeAll": false,
"showDefault": false
},
"defaultValue": "value::all"
},
{
"id": "91aa9ba3-ed60-4472-8dd9-1c2cb6255757",
"version": "KqlParameterItem/1.0",
"name": "ResourceGroup",
"label": "Resource Group",
"type": 2,
"isRequired": true,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "resources\r\n| distinct resourceGroup",
"crossComponentResources": [
"{Subscriptions}"
],
"typeSettings": {
"additionalResourceOptions": [
"value::all"
],
"showDefault": false
},
"defaultValue": "value::all",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
{
"id": "5a4f6d34-9f89-4ef8-b4ee-fb0580ec016d",
"version": "KqlParameterItem/1.0",
"name": "Environment",
"label": "Environment",
"type": 2,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "resources\r\n| extend Environment = case(\r\ntags.Environment <> \"\", replace(\"\\\\\\\\\", \"<Backslash>\", tostring(tags.Environment)),\r\ntags.environment <> \"\", replace(\"\\\\\\\\\", \"<Backslash>\", tostring(tags.environment)),\r\ntags.Env <> \"\", replace(\"\\\\\\\\\", \"<Backslash>\", tostring(tags.Env)),\r\ntags.env <> \"\", replace(\"\\\\\\\\\", \"<Backslash>\", tostring(tags.env)),\r\ntolower(name) contains \"prod\", \"Production\",\r\ntolower(name) contains \"dev\", \"Development\",\r\ntolower(name) contains \"qa\", \"QA\",\r\ntolower(name) contains \"uat\", \"UAT\",\r\ntolower(name) contains \"sit\", \"SIT\",\r\ntolower(name) contains \"test\", \"Test\",\r\n\"Undefined\")\r\n| distinct Environment",
"crossComponentResources": [
"{Subscriptions}"
],
"typeSettings": {
"additionalResourceOptions": [
"value::all"
],
"showDefault": false
},
"defaultValue": "value::all",
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources"
},
{
"id": "9d6afcdc-172c-4bef-8bab-dc372c5d3bb4",
"version": "KqlParameterItem/1.0",
"name": "TagName",
"label": "Tag Name",
"type": 2,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "Resources\r\n| where tags != '' and tags != '[]'\r\n| mvexpand tags\r\n| extend tagName = replace(\"\\\\\\\\\", \"<Backslash>\", tostring(bag_keys(tags)[0]))\r\n| distinct tagName\r\n| sort by tagName asc",
"crossComponentResources": [
"{Subscriptions}"
],
"typeSettings": {
"additionalResourceOptions": [
"value::all"
],
"selectAllValue": "*"
},
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"value": [
"value::all"
]
},
{
"id": "95781001-338b-4ed3-81dc-ce16f2a98bf0",
"version": "KqlParameterItem/1.0",
"name": "TagValue",
"label": "Tag Value",
"type": 2,
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"query": "Resources\r\n| mvexpand tags\r\n| extend tagName = replace(\"\\\\\\\\\", \"<Backslash>\", tostring(bag_keys(tags)[0]))\r\n| extend tagValue = replace(\"\\\\\\\\\", \"<Backslash>\", tostring(tags[tagName]))\r\n| where tags != '' and tags != '[]' \r\n| where ('*' in (dynamic([{TagName}])) or tagName in (dynamic([{TagName}]))) \r\n| distinct tagValue\r\n| sort by tagValue asc",
"crossComponentResources": [
"{Subscriptions}"
],
"typeSettings": {
"additionalResourceOptions": [
"value::all"
],
"selectAllValue": "*"
},
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"value": [
"value::all"
]
},
{
"id": "e929bc01-08ec-45fe-bc6a-4e0267460dfa",
"version": "KqlParameterItem/1.0",
"name": "SLA",
"label": "Show SLA",
"type": 10,
"description": "This will show the SLA information for the focus area",
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": [],
"showDefault": false
},
"jsonData": "[{ \"value\": \"Yes\", \"label\": \"Yes\", \"selected\":true},\r\n {\"value\": \"No\", \"label\": \"No\"}]"
},
{
"id": "9581cbc6-0f0f-42be-8ae8-6fe94de00ab8",
"version": "KqlParameterItem/1.0",
"name": "Help",
"label": "Show Help",
"type": 10,
"isRequired": true,
"typeSettings": {
"additionalResourceOptions": []
},
"jsonData": "[{\"value\": \"Yes\", \"label\": \"Yes\", \"selected\":true },\r\n {\"value\": \"No\", \"label\": \"No\"}]"
}
],
"style": "pills",
"queryType": 0,
"resourceType": "microsoft.operationalinsights/workspaces"
},
"name": "parameters - 13"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 11,
"content": {
"version": "LinkItem/1.0",
"style": "tabs",
"links": [
{
"id": "bec50763-3978-4739-8e39-ffc849278745",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "Virtual Machines",
"subTarget": "cVM",
"style": "link"
},
{
"id": "db54cc9d-e67e-4687-b9e6-e73aefb9638c",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "Virtual Machine Scale Sets",
"subTarget": "cVMSS",
"style": "link"
}
]
},
"name": "links - 5"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 1,
"content": {
"json": "[SLA for Virtual Machines](https://azure.microsoft.com/support/legal/sla/virtual-machines/)\r\n* For all Virtual Machines that have two or more instances deployed across two or more Availability Zones in the same Azure region, we guarantee you will have Virtual Machine Connectivity to at least one instance at least 99.99% of the time.\r\n* For all Virtual Machines that have two or more instances deployed in the same Availability Set or in the same Dedicated Host Group, we guarantee you will have Virtual Machine Connectivity to at least one instance at least 99.95% of the time.\r\n* For any Single Instance Virtual Machine using Premium SSD or Ultra Disk for all Operating System Disks and Data Disks, we guarantee you will have Virtual Machine Connectivity of at least 99.9%.\r\n* For any Single Instance Virtual Machine using Standard SSD Managed Disks for Operating System Disk and Data Disks, we guarantee you will have Virtual Machine Connectivity of at least 99.5%.\r\n* For any Single Instance Virtual Machine using Standard HDD Managed Disks for Operating System Disks and Data Disks, we guarantee you will have Virtual Machine Connectivity of at least 95%.\r\n\r\n> SLA accurate at time of release. Latest information is available [here](https://azure.microsoft.com/support/legal/sla/virtual-machines/)",
"style": "upsell"
},
"conditionalVisibility": {
"parameterName": "SLA",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 2"
},
{
"type": 1,
"content": {
"json": "> [Virtual machine resilliency checklist](https://learn.microsoft.com/azure/architecture/checklist/resiliency-per-service#virtual-machines)\r\n* Avoid running a production workload on a single VM. A single VM deployment is not resilient to planned or unplanned maintenance. Instead, put multiple VMs in an availability set or virtual machine scale set, with a load balancer in front.\r\n* Specify an availability set when you provision the VM. Currently, there is no way to add a VM to an availability set after the VM is provisioned. When you add a new VM to an existing availability set, make sure to create a NIC for the VM, and add the NIC to the back-end address pool on the load balancer. Otherwise, the load balancer won't route network traffic to that VM.\r\n* Put each application tier into a separate Availability Set. In an N-tier application, don't put VMs from different tiers into the same availability set. VMs in an availability set are placed across fault domains (FDs) and update domains (UD). However, to get the redundancy benefit of FDs and UDs, every VM in the availability set must be able to handle the same client requests.\r\n* Replicate VMs using Azure Site Recovery. When you replicate Azure VMs using Site Recovery, all the VM disks are continuously replicated to the target region asynchronously. The recovery points are created every few minutes. This gives you a Recovery Point Objective (RPO) in the order of minutes. You can conduct disaster recovery drills as many times as you want, without affecting the production application or the ongoing replication.\r\n* Choose the right VM size based on performance requirements. When moving an existing workload to Azure, start with the VM size that's the closest match to your on-premises servers. Then measure the performance of your actual workload with respect to CPU, memory, and disk IOPS, and adjust the size if needed. This helps to ensure the application behaves as expected in a cloud environment. Also, if you need multiple NICs, be aware of the NIC limit for each size.\r\n* Use managed disks for VHDs. Managed disks provide better reliability for VMs in an availability set, because the disks are sufficiently isolated from each other to avoid single points of failure. Also, managed disks aren't subject to the IOPS limits of VHDs created in a storage account.\r\n* Install applications on a data disk, not the OS disk. Otherwise, you may reach the disk size limit.\r\n* Use Azure Backup to back up VMs. Backups protect against accidental data loss.\r\n* Enable diagnostic logs. Include basic health metrics, infrastructure logs, and boot diagnostics. Boot diagnostics can help you diagnose a boot failure if your VM gets into a nonbootable state.\r\n* Configure Azure Monitor. Collect and analyze monitoring data from Azure virtual machines including the guest operating system and the workloads that run in it.\r\n\r\n* Azure Security Center with Azure Defender is required for VM backup information.\r\n* VMs have to be running for disk information to be available.\r\n* VM SLAs apply to both operating system and data disks - only operating system disks are represented in this workbook.\r\n\r\n> Azure generally recommends to leverage [Availability Zone](https://learn.microsoft.com/azure/availability-zones/az-overview) for better High Availability within the region by leveraging multiple zones inside region. By architecting your solutions to use replicated services in zones, you can protect your apps and data from the loss of a datacenter. \r\n\r\n> At this point, not all Azure regions and services support Availability Zones, the support matrix can be found [here](https://learn.microsoft.com/azure/availability-zones/az-region). Whenerver there is a Zonal recommendation for a particular service from this workbook, please note that that is applicable only for the regions supporting Availability Zones from the earlier list.",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "Help",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 3"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "resources\n| where resourceGroup in ({ResourceGroup})\n| extend environment = case(\n tags.Environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Environment)),\n tags.environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.environment)),\n tags.Env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Env)),\n tags.env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.env)),\n tolower(name) contains \"prod\", \"Production\",\n tolower(name) contains \"dev\", \"Development\",\n tolower(name) contains \"qa\", \"QA\",\n tolower(name) contains \"uat\", \"UAT\",\n tolower(name) contains \"sit\", \"SIT\",\n tolower(name) contains \"test\", \"Test\",\n \"Undefined\")\n| where environment in ({Environment})\n| join kind = inner(\n resources\n | extend tagName = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(bag_keys(tags)[0]))\n | extend tagValue = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags[tagName]))\n | distinct tagName,tagValue,id\n | where (('*' in (dynamic([{TagName}])) or tagName in (dynamic([{TagName}])))) and (('*' in (dynamic([{TagValue}])) or tagValue in (dynamic([{TagValue}]))))\n | distinct id\n)\non id\n| where \n (type == 'microsoft.compute/virtualmachines') or \n (type == 'microsoft.classiccompute/virtualmachines') or \n (type == \"microsoft.compute/virtualmachinescalesets\" and tags.aksEngineVersion !contains \"aks-gomod\") or\n (type == 'microsoft.web/sites') or \n (type == 'microsoft.web/serverfarms') or\n (type == \"microsoft.containerservice/managedclusters\") or \n (type == 'microsoft.sql/servers/databases') or \n (type == 'microsoft.documentdb/databaseaccounts') or \n (type == 'microsoft.dbformysql/servers') or \n (type == 'microsoft.dbformysql/flexibleservers') or\n (type == 'microsoft.dbforpostgresql/servers') or \n (type == 'microsoft.dbforpostgresql/flexibleservers') or \n (type == 'microsoft.cache/redis') or\n (type == \"microsoft.apimanagement/service\") or \n (type == \"microsoft.storage/storageaccounts\" or type == \"microsoft.classicstorage/storageaccounts\") or \n (type == \"microsoft.network/azurefirewalls\") or \n (type == \"microsoft.network/frontdoors\") or\n (type == \"microsoft.cdn/profiles\") or\n (type == \"microsoft.network/applicationgateways\") or \n (type == \"microsoft.network/loadbalancers\") or \n (type == \"microsoft.network/publicipaddresses\" or type == \"microsoft.network/publicipprefixes\") or \n (type == \"microsoft.network/virtualnetworkgateways\") or \n (type == \"microsoft.recoveryservices/vaults\")\n| join kind=leftouter (\n resources \n | where type == \"microsoft.containerservice/managedclusters\"\n // Expand per node pool to get using zone for all node pool\n | mv-expand agentPoolProfiles = properties.agentPoolProfiles\n | extend AvZones = agentPoolProfiles.availabilityZones\n | extend AksNodeResourceGroup = tolower(tostring(properties.nodeResourceGroup))\n // Get number of using zone per node pool VMSS. If it doesn't use any zone, return 0\n | extend useAvZone = case(\n array_length( AvZones ) \u003e 0, array_length( AvZones ), 0\n )\n | join kind=leftouter(\n resources\n | where type == 'microsoft.compute/virtualmachinescalesets'\n | extend resourceGroup = tolower(tostring(resourceGroup))\n | extend VmssCapacity = sku.capacity\n | extend vmssStorageAccountType = iff(\n properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType\n )\n ) on $left.AksNodeResourceGroup == $right.resourceGroup // Match AKS and VMSS with nodeResourceGroup\n | summarize AvZones=min(useAvZone), AksMinimumNodePoolCount=min(toint(VmssCapacity)), AksNodePoolStorageAccountType=make_set(vmssStorageAccountType), FaultDomainCount=min(toint(properties1.platformFaultDomainCount)) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), tostring(plan), tostring(properties), AksNodeResourceGroup\n | extend AksNodePoolStorageAccountType = iff(\n tolower(tostring(AksNodePoolStorageAccountType)) contains \"standard_lrs\", \"standard_lrs\", tolower(tostring(strcat_array(AksNodePoolStorageAccountType, \",\")))\n )\n // If there are some node pools within AKS cluster, it returns minimum number of zones. \n // If even one node pool is not using a zone, it will be \"Not Configured\".\n | extend AvZones = iff(tostring(AvZones) == \"0\", \"Not Configured\", tostring(AvZones)), AvSets = \"Scale Sets\"\n) on id\n// Start - Azure Load Balancer additional logic\n| mv-expand LbFeIpConfig = properties.frontendIPConfigurations\n| extend LbUseAvZone = iff(array_length(LbFeIpConfig.zones ) \u003e 0, array_length(LbFeIpConfig.zones ), 0)\n| extend LbIpType = iff(isnotnull(LbFeIpConfig.properties.publicIPAddress), \"Public\", \"Private\")\n//| summarize LbAvZones = min(LbUseAvZone) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), plan, tostring(properties)\n//| extend properties = todynamic(properties), sku = todynamic(sku), \n| summarize LbAvZones = arg_min(LbUseAvZone, *) by id\n// End - Azure Load Balancer additional logic\n| extend state = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.extended.instanceView.powerState.displayStatus),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.instanceView.powerState),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(properties.provisioningState),\n type == 'microsoft.web/sites', tostring(properties.state),\n type == 'microsoft.web/serverfarms', tostring(properties.status),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.provisioningState),\n type == 'microsoft.sql/servers/databases', tostring(properties.status),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.provisioningState),\n type == 'microsoft.dbformysql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbformysql/flexibleservers', tostring(properties.state),\n type == 'microsoft.dbforpostgresql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(properties.state),\n type == 'microsoft.cache/redis', tostring(properties.provisioningState),\n type == \"microsoft.apimanagement/service\", tostring(properties.provisioningState),\n type contains \"storageaccounts\", tostring(properties.provisioningState),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.provisioningState),\n type == \"microsoft.network/frontdoors\", tostring(properties.resourceState),\n type == \"microsoft.cdn/profiles\", tostring(properties.resourceState),\n type == \"microsoft.network/applicationgateways\", tostring(properties.operationalState),\n type == \"microsoft.network/loadbalancers\", tostring(properties.provisioningState),\n type contains \"publicip\", tostring(properties.provisioningState),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.provisioningState),\n type == \"microsoft.recoveryservices/vaults\", tostring(properties.provisioningState),\n \"Undefined\"\n )\n| extend skuName = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.hardwareProfile.vmSize),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.hardwareProfile.size),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.name),\n type == 'microsoft.web/sites', tostring(properties.sku),\n type == 'microsoft.web/serverfarms', tostring(sku.tier),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.agentPoolProfiles[0].vmSize),\n type == 'microsoft.sql/servers/databases', tostring(sku.tier),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.databaseAccountOfferType),\n type == 'microsoft.dbformysql/servers', tostring(sku.tier),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.cache/redis', tostring(properties.sku.name),\n type == \"microsoft.apimanagement/service\", tostring(sku.name),\n type contains 'storageaccounts', tostring(replace('-', '_', tostring(iff(type =~ \"microsoft.storage/storageaccounts\", sku.name, properties.accountType)))),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.sku.name),\n type == \"microsoft.network/frontdoors\", \"classic_frontdoor\",\n type == \"microsoft.cdn/profiles\", tostring(sku.name),\n type == \"microsoft.network/applicationgateways\", tostring(properties.sku.name),\n type == \"microsoft.network/loadbalancers\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type contains \"publicip\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.name),\n type == \"microsoft.recoveryservices/vaults\", tostring(iif(isnotnull(sku.tier), sku.tier, sku.name)),\n \"Undefined\"\n )\n| extend avZones = case(\n // reffer to: https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support\n location !in~ ('brazilsouth', 'canadacentral', 'centralus', 'eastus', 'eastus2', 'southcentralus', 'usgovvirginia', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachines'), coalesce(tostring(zones[0]), 'Not Configured'),\n (type == 'microsoft.classiccompute/virtualmachines'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachinescalesets'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == 'microsoft.containerservice/managedclusters' and AvZones \u003c\u003e \"\"), AvZones,\n (type == 'microsoft.containerservice/managedclusters' and isempty(AvZones)), \"Not Configured\",\n (type == 'microsoft.web/sites'), \"ASP AZ config\",\n (type == 'microsoft.web/serverfarms'), iff(properties.zoneRedundant == 'true', 'Configured', 'Not Configured'),\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), case( //SQL AZ SKU \u0026 region availability filter\n sku.tier == 'Basic' or sku.tier == 'Standard' or sku.name == 'System', 'Not Applicable',\n // Outside of these regions, SQL DB is not available in AZ. Refer to: https://learn.microsoft.com/en-us/azure/azure-sql/database/high-availability-sla?view=azuresql\u0026tabs=azure-powershell#general-purpose-service-tier-zone-redundant-availability\n sku.tier == 'GeneralPurpose' and location !in~ ('brazilsouth', 'eastus', 'eastus2', 'southcentralus', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n properties.zoneRedundant == 'true', 'Configured',\n 'Not Configured'\n ),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts'), iif(properties.locations[0].isZoneRedundant == \"false\", 'Not Configured', 'Configured'), \n (type == 'microsoft.dbformysql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.dbforpostgresql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole contains \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.cache/redis'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == \"microsoft.apimanagement/service\"), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type contains 'storageaccounts'), case(split(skuName, '_', 1)[0] contains \"zrs\", \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/azurefirewalls\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/loadbalancers\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n LbIpType =~ \"Public\", \"Public IP AZ Config\",\n tostring(LbAvZones) =~ \"0\", \"Not Configured\",\n tostring(LbAvZones)\n ),\n (type contains \"publicip\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n coalesce(tostring(array_length(parse_json(zones))), 'Not Configured')\n ),\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Public IP AZ Config\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend avSets = case(\n type == 'microsoft.compute/virtualmachines' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachines', (coalesce(extract('/availabilitySets/(.*)', 1, tostring(properties.availabilitySet.id)), 'Not Configured')),\n type == 'microsoft.classiccompute/virtualmachines', iff(isnotnull(properties.hardwareProfile.availabilitySet), 'Configured', 'Not Configured'),\n type == 'microsoft.compute/virtualmachinescalesets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', 'A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.',\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', case(\n AvSets == 'Scale Sets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n AvSets == 'Scale Sets', \"A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.\",\n \"Scale Sets Not Configured\"\n ),\n type == 'microsoft.sql/servers/databases', 'Not Applicable',\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', \"Not Applicable\",\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", tostring(properties.publicIPAddressVersion), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.gatewayType), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend Capacity = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.capacity),\n type == 'microsoft.web/sites', \"ASP Config\",\n type == 'microsoft.web/serverfarms', tostring(sku.capacity),\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(AksMinimumNodePoolCount), tostring(AksMinimumNodePoolCount), \"0\"), // AKS with or without VMSS\n type == 'microsoft.sql/servers/databases', tostring(sku.capacity),\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', tostring(sku.capacity),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.cache/redis', strcat(properties.sku.family, properties.sku.capacity),\n type == \"microsoft.apimanagement/service\", tostring(sku.capacity),\n type contains \"storageaccounts\", \"Not Applicable\", \n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", tostring(iif(isnotempty(properties.autoscaleConfiguration), properties.autoscaleConfiguration.minCapacity, properties.sku.capacity)),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", iif(type == \"microsoft.network/publicipprefixes\", \"PIP-prefix\", \"Single\"), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.capacity),\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend FaultDomain = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', iif(isnotempty(properties.platformFaultDomainCount), properties.platformFaultDomainCount, \"0\"), // 1 - AZ, 5 - Regional VMSS\n type == 'microsoft.web/sites', \"Not Applicable\",\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(tostring(FaultDomainCount)), tostring(FaultDomainCount), \"0\"),\n type == 'microsoft.sql/servers/databases', \"Not Applicable\",\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\" and properties.vpnType == \"PolicyBased\", \"ErPolicyBased\", tostring(properties.vpnType)), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend osDisk = case(\n type == 'microsoft.compute/virtualmachines', iif(properties.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.classiccompute/virtualmachines', 'Classic',\n type == 'microsoft.compute/virtualmachinescalesets', iif(properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', AksNodePoolStorageAccountType,\n type == 'microsoft.sql/servers/databases', properties.currentBackupStorageRedundancy,\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.platformVersion), //Field Override\n type contains \"storageaccounts\", tostring(split(skuName, '_', 0)[0]),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", tostring(LbIpType), //Field Override\n type contains \"publicip\", tostring(properties.publicIPAllocationMethod), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.vpnGatewayGeneration), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n 'Not Applicable'\n )\n| extend OSDisk = case(\n isnotempty(osDisk), osDisk,\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and state \u003c\u003e 'VM running', 'Unknown, start VM to get disk information.',\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and isnotempty(properties.storageProfile.osDisk.vhd.uri), 'Unmanaged',\n \"Unknown\")\n| extend ReadReplica = case (\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), tostring(properties.readReplicaCount), // SQL DB\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\", // Synapse\n type == 'microsoft.documentdb/databaseaccounts', tostring(array_length(parse_json(properties.readLocations))),\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.additionalLocations),\n type contains \"storageaccounts\", case(\n // Use the following query to get 3+0 regions: az account list-locations -o table --query '[?availabilityZoneMappings \u0026\u0026 (!metadata.pairedRegion || length(metadata.pairedRegion) == `0`)]'\n location in~ ('qatarcentral', 'polandcentral', 'israelcentral', 'italynorth') and split(skuName, '_', 1)[0] startswith \"zrs\" , 'Configured',\n split(skuName, '_', 1)[0] startswith \"ra\", \"Configured\",\n \"Not Configured\"\n ),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\", \"Not Applicable\", tostring(properties.activeActive)), //Field Override,\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend AutomaticFailover = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"false\" and properties.enableMultipleWriteLocations == \"false\" and toint(ReadReplica) \u003e 1), \"Not Configured\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"true\"), \"Configured\",\n (type == 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', case(\n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole != \"Replica\" , \"Not Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', case( \n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Not Configured\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbformysql/flexibleservers', case(properties.haEnabled == \"Enabled\", \"Configured\", \"Not Applicable\"),\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", iif(isnotempty(properties.autoscaleConfiguration), \"Configured\", \"Not Configured\"),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", \"Not Applicable\",\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend MultipleWriteLocations = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.dbformysql/servers', 'microsoft.dbformysql/flexibleservers', 'microsoft.dbforpostgresql/servers', 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"false\"), \"Not Enabled\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"true\"), \"Enabled\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend StorageAutogrow = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbformysql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend ReplicationRole = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), iif(isnotempty(properties.secondaryType), \"replica\", \"master\"),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbformysql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), tostring(split(skuName, '_', 1)[0]),\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| project \n Type = tolower(type),\n SkuName = tolower(skuName),\n Kind = tolower(kind),\n SubscriptionId = subscriptionId,\n Name = tolower(tostring(id)),\n State = tolower(state),\n Location = tolower(location),\n ResourceGroup = resourceGroup,\n Zones = tolower(tostring(zones)),\n AvailabilityZone = tolower(avZones),\n AvailabilitySet = tolower(avSets),\n Capacity = tolower(Capacity),\n FaultDomain = tolower(FaultDomain),\n OSDisk = tolower(OSDisk),\n ReadReplica = tolower(ReadReplica), \n AutomaticFailover = tolower(AutomaticFailover),\n MultipleWriteLocations = tolower(MultipleWriteLocations),\n StorageAutogrow = tolower(StorageAutogrow),\n ReplicationRole = tolower(ReplicationRole),\n Environment = environment,\n properties\n| join kind = leftouter (\n recoveryservicesresources\n | extend vmId = case(\n properties.backupManagementType == \"AzureIaasVM\", tolower(tostring(properties.dataSourceInfo.resourceID)),\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(properties.providerSpecificDetails.dataSourceInfo.resourceId)),\n ''\n )\n | extend asrId = iff(type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(strcat_array(array_slice(split(properties.recoveryFabricId, '/'), 0, 8), '/'))), '')\n | extend resourceId = case(\n properties.backupManagementType == \"AzureIaasVM\", vmId,\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", asrId,\n ''\n )\n | extend Backup = tostring(properties.protectionStatus)\n | extend replicationHealth = properties.replicationHealth\n | extend failoverHealth = properties.failoverHealth\n | extend protectionStateDescription = properties.protectionStateDescription\n | extend isReplicationAgentUpdateRequired = properties.providerSpecificDetails.isReplicationAgentUpdateRequired\n | project resourceId, vmId, asrId, Backup, replicationHealth, failoverHealth, protectionStateDescription, isReplicationAgentUpdateRequired\n )\n on $left.Name == $right.resourceId\n| extend Backup = case(\n Backup == \"Healthy\" or Backup == \"Unhealthy\", Backup,\n \"Unknown\")\n| extend Backup = case(\n (Type == 'microsoft.compute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == 'microsoft.classiccompute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == \"microsoft.compute/virtualmachinescalesets\"), \"Not Applicable\", \n (Type == \"microsoft.containerservice/managedclusters\"), \"Not Applicable\",\n (Type == 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (Type == 'microsoft.documentdb/databaseaccounts'), iif(properties.backupPolicy.type!=\"Continuous\",iif(properties.backupPolicy.periodicModeProperties.backupStorageRedundancy == \"Geo\", \"Geo\", \"Not Geo\"),\"Continuous\"),\n (Type == 'microsoft.dbformysql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbformysql/flexibleservers'), properties.backup.geoRedundantBackup,\n (Type == 'microsoft.dbforpostgresql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbforpostgresql/flexibleservers'), case(\n properties.backup.geoRedundantBackup == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Disabled\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.backup.geoRedundantBackup\n ),\n (Type contains \"storageaccounts\"), \"Not Applicable\",\n (Type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (Type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Unknown\"\n )\n| extend AvailabilitySet = case(\n AvailabilitySet == '-', 'None',\n isnotempty(AvailabilitySet), AvailabilitySet,\n \"Unknown\")\n\n| project Type, SkuName, Kind, SubscriptionId, Name, State, Location, ResourceGroup, Zones, AvailabilityZone, AvailabilitySet, Capacity, FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), Environment\n| where Type == 'microsoft.compute/virtualmachines'\n| summarize ResourceTotal=count(Name), NotRunning=dcountif(Name, State != \"vm running\"), NoAVZone=dcountif(Name, AvailabilityZone == \"not configured\"), NoAVSet=dcountif(Name, AvailabilitySet == \"not configured\"), OSDiskRecommendation=dcountif(Name, (OSDisk != \"premium_lrs\" and OSDisk != \"ephemeral\")), NoBackup=dcountif(Name, Backup == \"not configured\"), UnHealthyBackup=dcountif(Name, Backup == \"unhealthy\")",
"size": 3,
"title": "Virtual Machines - Recommendation Summary",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"rowLimit": 10000,
"formatters": [
{
"columnMatch": "ResourceTotal",
"formatter": 22,
"formatOptions": {
"compositeBarSettings": {
"labelText": "",
"columnSettings": [
{
"columnName": "NotRunning",
"color": "amethyst"
},
{
"columnName": "NoAVZone",
"color": "blue"
},
{
"columnName": "NoAVSet",
"color": "brown"
},
{
"columnName": "OSDiskRecommendation",
"color": "orange"
},
{
"columnName": "NoBackup",
"color": "pink"
},
{
"columnName": "UnHealthyBackup",
"color": "redBright"
}
]
}
}
}
],
"labelSettings": [
{
"columnId": "ResourceTotal",
"label": "Resource Total"
},
{
"columnId": "NotRunning",
"label": "VM Not Running"
},
{
"columnId": "NoAVZone",
"label": "No Availability Zone"
},
{
"columnId": "NoAVSet",
"label": "No Availability Set"
},
{
"columnId": "OSDiskRecommendation",
"label": "OS Disk Recommendation"
},
{
"columnId": "NoBackup",
"label": "Missing Backup"
},
{
"columnId": "UnHealthyBackup",
"label": "Unhealthy Backup"
}
]
},
"sortBy": []
},
"name": "kql_compute_vm_resources_details_summary"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "resources\n| where resourceGroup in ({ResourceGroup})\n| extend environment = case(\n tags.Environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Environment)),\n tags.environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.environment)),\n tags.Env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Env)),\n tags.env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.env)),\n tolower(name) contains \"prod\", \"Production\",\n tolower(name) contains \"dev\", \"Development\",\n tolower(name) contains \"qa\", \"QA\",\n tolower(name) contains \"uat\", \"UAT\",\n tolower(name) contains \"sit\", \"SIT\",\n tolower(name) contains \"test\", \"Test\",\n \"Undefined\")\n| where environment in ({Environment})\n| join kind = inner(\n resources\n | extend tagName = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(bag_keys(tags)[0]))\n | extend tagValue = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags[tagName]))\n | distinct tagName,tagValue,id\n | where (('*' in (dynamic([{TagName}])) or tagName in (dynamic([{TagName}])))) and (('*' in (dynamic([{TagValue}])) or tagValue in (dynamic([{TagValue}]))))\n | distinct id\n)\non id\n| where \n (type == 'microsoft.compute/virtualmachines') or \n (type == 'microsoft.classiccompute/virtualmachines') or \n (type == \"microsoft.compute/virtualmachinescalesets\" and tags.aksEngineVersion !contains \"aks-gomod\") or\n (type == 'microsoft.web/sites') or \n (type == 'microsoft.web/serverfarms') or\n (type == \"microsoft.containerservice/managedclusters\") or \n (type == 'microsoft.sql/servers/databases') or \n (type == 'microsoft.documentdb/databaseaccounts') or \n (type == 'microsoft.dbformysql/servers') or \n (type == 'microsoft.dbformysql/flexibleservers') or\n (type == 'microsoft.dbforpostgresql/servers') or \n (type == 'microsoft.dbforpostgresql/flexibleservers') or \n (type == 'microsoft.cache/redis') or\n (type == \"microsoft.apimanagement/service\") or \n (type == \"microsoft.storage/storageaccounts\" or type == \"microsoft.classicstorage/storageaccounts\") or \n (type == \"microsoft.network/azurefirewalls\") or \n (type == \"microsoft.network/frontdoors\") or\n (type == \"microsoft.cdn/profiles\") or\n (type == \"microsoft.network/applicationgateways\") or \n (type == \"microsoft.network/loadbalancers\") or \n (type == \"microsoft.network/publicipaddresses\" or type == \"microsoft.network/publicipprefixes\") or \n (type == \"microsoft.network/virtualnetworkgateways\") or \n (type == \"microsoft.recoveryservices/vaults\")\n| join kind=leftouter (\n resources \n | where type == \"microsoft.containerservice/managedclusters\"\n // Expand per node pool to get using zone for all node pool\n | mv-expand agentPoolProfiles = properties.agentPoolProfiles\n | extend AvZones = agentPoolProfiles.availabilityZones\n | extend AksNodeResourceGroup = tolower(tostring(properties.nodeResourceGroup))\n // Get number of using zone per node pool VMSS. If it doesn't use any zone, return 0\n | extend useAvZone = case(\n array_length( AvZones ) \u003e 0, array_length( AvZones ), 0\n )\n | join kind=leftouter(\n resources\n | where type == 'microsoft.compute/virtualmachinescalesets'\n | extend resourceGroup = tolower(tostring(resourceGroup))\n | extend VmssCapacity = sku.capacity\n | extend vmssStorageAccountType = iff(\n properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType\n )\n ) on $left.AksNodeResourceGroup == $right.resourceGroup // Match AKS and VMSS with nodeResourceGroup\n | summarize AvZones=min(useAvZone), AksMinimumNodePoolCount=min(toint(VmssCapacity)), AksNodePoolStorageAccountType=make_set(vmssStorageAccountType), FaultDomainCount=min(toint(properties1.platformFaultDomainCount)) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), tostring(plan), tostring(properties), AksNodeResourceGroup\n | extend AksNodePoolStorageAccountType = iff(\n tolower(tostring(AksNodePoolStorageAccountType)) contains \"standard_lrs\", \"standard_lrs\", tolower(tostring(strcat_array(AksNodePoolStorageAccountType, \",\")))\n )\n // If there are some node pools within AKS cluster, it returns minimum number of zones. \n // If even one node pool is not using a zone, it will be \"Not Configured\".\n | extend AvZones = iff(tostring(AvZones) == \"0\", \"Not Configured\", tostring(AvZones)), AvSets = \"Scale Sets\"\n) on id\n// Start - Azure Load Balancer additional logic\n| mv-expand LbFeIpConfig = properties.frontendIPConfigurations\n| extend LbUseAvZone = iff(array_length(LbFeIpConfig.zones ) \u003e 0, array_length(LbFeIpConfig.zones ), 0)\n| extend LbIpType = iff(isnotnull(LbFeIpConfig.properties.publicIPAddress), \"Public\", \"Private\")\n//| summarize LbAvZones = min(LbUseAvZone) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), plan, tostring(properties)\n//| extend properties = todynamic(properties), sku = todynamic(sku), \n| summarize LbAvZones = arg_min(LbUseAvZone, *) by id\n// End - Azure Load Balancer additional logic\n| extend state = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.extended.instanceView.powerState.displayStatus),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.instanceView.powerState),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(properties.provisioningState),\n type == 'microsoft.web/sites', tostring(properties.state),\n type == 'microsoft.web/serverfarms', tostring(properties.status),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.provisioningState),\n type == 'microsoft.sql/servers/databases', tostring(properties.status),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.provisioningState),\n type == 'microsoft.dbformysql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbformysql/flexibleservers', tostring(properties.state),\n type == 'microsoft.dbforpostgresql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(properties.state),\n type == 'microsoft.cache/redis', tostring(properties.provisioningState),\n type == \"microsoft.apimanagement/service\", tostring(properties.provisioningState),\n type contains \"storageaccounts\", tostring(properties.provisioningState),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.provisioningState),\n type == \"microsoft.network/frontdoors\", tostring(properties.resourceState),\n type == \"microsoft.cdn/profiles\", tostring(properties.resourceState),\n type == \"microsoft.network/applicationgateways\", tostring(properties.operationalState),\n type == \"microsoft.network/loadbalancers\", tostring(properties.provisioningState),\n type contains \"publicip\", tostring(properties.provisioningState),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.provisioningState),\n type == \"microsoft.recoveryservices/vaults\", tostring(properties.provisioningState),\n \"Undefined\"\n )\n| extend skuName = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.hardwareProfile.vmSize),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.hardwareProfile.size),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.name),\n type == 'microsoft.web/sites', tostring(properties.sku),\n type == 'microsoft.web/serverfarms', tostring(sku.tier),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.agentPoolProfiles[0].vmSize),\n type == 'microsoft.sql/servers/databases', tostring(sku.tier),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.databaseAccountOfferType),\n type == 'microsoft.dbformysql/servers', tostring(sku.tier),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.cache/redis', tostring(properties.sku.name),\n type == \"microsoft.apimanagement/service\", tostring(sku.name),\n type contains 'storageaccounts', tostring(replace('-', '_', tostring(iff(type =~ \"microsoft.storage/storageaccounts\", sku.name, properties.accountType)))),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.sku.name),\n type == \"microsoft.network/frontdoors\", \"classic_frontdoor\",\n type == \"microsoft.cdn/profiles\", tostring(sku.name),\n type == \"microsoft.network/applicationgateways\", tostring(properties.sku.name),\n type == \"microsoft.network/loadbalancers\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type contains \"publicip\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.name),\n type == \"microsoft.recoveryservices/vaults\", tostring(iif(isnotnull(sku.tier), sku.tier, sku.name)),\n \"Undefined\"\n )\n| extend avZones = case(\n // reffer to: https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support\n location !in~ ('brazilsouth', 'canadacentral', 'centralus', 'eastus', 'eastus2', 'southcentralus', 'usgovvirginia', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachines'), coalesce(tostring(zones[0]), 'Not Configured'),\n (type == 'microsoft.classiccompute/virtualmachines'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachinescalesets'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == 'microsoft.containerservice/managedclusters' and AvZones \u003c\u003e \"\"), AvZones,\n (type == 'microsoft.containerservice/managedclusters' and isempty(AvZones)), \"Not Configured\",\n (type == 'microsoft.web/sites'), \"ASP AZ config\",\n (type == 'microsoft.web/serverfarms'), iff(properties.zoneRedundant == 'true', 'Configured', 'Not Configured'),\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), case( //SQL AZ SKU \u0026 region availability filter\n sku.tier == 'Basic' or sku.tier == 'Standard' or sku.name == 'System', 'Not Applicable',\n // Outside of these regions, SQL DB is not available in AZ. Refer to: https://learn.microsoft.com/en-us/azure/azure-sql/database/high-availability-sla?view=azuresql\u0026tabs=azure-powershell#general-purpose-service-tier-zone-redundant-availability\n sku.tier == 'GeneralPurpose' and location !in~ ('brazilsouth', 'eastus', 'eastus2', 'southcentralus', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n properties.zoneRedundant == 'true', 'Configured',\n 'Not Configured'\n ),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts'), iif(properties.locations[0].isZoneRedundant == \"false\", 'Not Configured', 'Configured'), \n (type == 'microsoft.dbformysql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.dbforpostgresql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole contains \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.cache/redis'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == \"microsoft.apimanagement/service\"), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type contains 'storageaccounts'), case(split(skuName, '_', 1)[0] contains \"zrs\", \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/azurefirewalls\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/loadbalancers\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n LbIpType =~ \"Public\", \"Public IP AZ Config\",\n tostring(LbAvZones) =~ \"0\", \"Not Configured\",\n tostring(LbAvZones)\n ),\n (type contains \"publicip\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n coalesce(tostring(array_length(parse_json(zones))), 'Not Configured')\n ),\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Public IP AZ Config\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend avSets = case(\n type == 'microsoft.compute/virtualmachines' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachines', (coalesce(extract('/availabilitySets/(.*)', 1, tostring(properties.availabilitySet.id)), 'Not Configured')),\n type == 'microsoft.classiccompute/virtualmachines', iff(isnotnull(properties.hardwareProfile.availabilitySet), 'Configured', 'Not Configured'),\n type == 'microsoft.compute/virtualmachinescalesets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', 'A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.',\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', case(\n AvSets == 'Scale Sets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n AvSets == 'Scale Sets', \"A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.\",\n \"Scale Sets Not Configured\"\n ),\n type == 'microsoft.sql/servers/databases', 'Not Applicable',\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', \"Not Applicable\",\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", tostring(properties.publicIPAddressVersion), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.gatewayType), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend Capacity = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.capacity),\n type == 'microsoft.web/sites', \"ASP Config\",\n type == 'microsoft.web/serverfarms', tostring(sku.capacity),\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(AksMinimumNodePoolCount), tostring(AksMinimumNodePoolCount), \"0\"), // AKS with or without VMSS\n type == 'microsoft.sql/servers/databases', tostring(sku.capacity),\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', tostring(sku.capacity),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.cache/redis', strcat(properties.sku.family, properties.sku.capacity),\n type == \"microsoft.apimanagement/service\", tostring(sku.capacity),\n type contains \"storageaccounts\", \"Not Applicable\", \n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", tostring(iif(isnotempty(properties.autoscaleConfiguration), properties.autoscaleConfiguration.minCapacity, properties.sku.capacity)),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", iif(type == \"microsoft.network/publicipprefixes\", \"PIP-prefix\", \"Single\"), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.capacity),\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend FaultDomain = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', iif(isnotempty(properties.platformFaultDomainCount), properties.platformFaultDomainCount, \"0\"), // 1 - AZ, 5 - Regional VMSS\n type == 'microsoft.web/sites', \"Not Applicable\",\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(tostring(FaultDomainCount)), tostring(FaultDomainCount), \"0\"),\n type == 'microsoft.sql/servers/databases', \"Not Applicable\",\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\" and properties.vpnType == \"PolicyBased\", \"ErPolicyBased\", tostring(properties.vpnType)), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend osDisk = case(\n type == 'microsoft.compute/virtualmachines', iif(properties.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.classiccompute/virtualmachines', 'Classic',\n type == 'microsoft.compute/virtualmachinescalesets', iif(properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', AksNodePoolStorageAccountType,\n type == 'microsoft.sql/servers/databases', properties.currentBackupStorageRedundancy,\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.platformVersion), //Field Override\n type contains \"storageaccounts\", tostring(split(skuName, '_', 0)[0]),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", tostring(LbIpType), //Field Override\n type contains \"publicip\", tostring(properties.publicIPAllocationMethod), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.vpnGatewayGeneration), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n 'Not Applicable'\n )\n| extend OSDisk = case(\n isnotempty(osDisk), osDisk,\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and state \u003c\u003e 'VM running', 'Unknown, start VM to get disk information.',\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and isnotempty(properties.storageProfile.osDisk.vhd.uri), 'Unmanaged',\n \"Unknown\")\n| extend ReadReplica = case (\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), tostring(properties.readReplicaCount), // SQL DB\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\", // Synapse\n type == 'microsoft.documentdb/databaseaccounts', tostring(array_length(parse_json(properties.readLocations))),\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.additionalLocations),\n type contains \"storageaccounts\", case(\n // Use the following query to get 3+0 regions: az account list-locations -o table --query '[?availabilityZoneMappings \u0026\u0026 (!metadata.pairedRegion || length(metadata.pairedRegion) == `0`)]'\n location in~ ('qatarcentral', 'polandcentral', 'israelcentral', 'italynorth') and split(skuName, '_', 1)[0] startswith \"zrs\" , 'Configured',\n split(skuName, '_', 1)[0] startswith \"ra\", \"Configured\",\n \"Not Configured\"\n ),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\", \"Not Applicable\", tostring(properties.activeActive)), //Field Override,\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend AutomaticFailover = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"false\" and properties.enableMultipleWriteLocations == \"false\" and toint(ReadReplica) \u003e 1), \"Not Configured\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"true\"), \"Configured\",\n (type == 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', case(\n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole != \"Replica\" , \"Not Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', case( \n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Not Configured\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbformysql/flexibleservers', case(properties.haEnabled == \"Enabled\", \"Configured\", \"Not Applicable\"),\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", iif(isnotempty(properties.autoscaleConfiguration), \"Configured\", \"Not Configured\"),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", \"Not Applicable\",\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend MultipleWriteLocations = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.dbformysql/servers', 'microsoft.dbformysql/flexibleservers', 'microsoft.dbforpostgresql/servers', 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"false\"), \"Not Enabled\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"true\"), \"Enabled\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend StorageAutogrow = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbformysql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend ReplicationRole = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), iif(isnotempty(properties.secondaryType), \"replica\", \"master\"),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbformysql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), tostring(split(skuName, '_', 1)[0]),\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| project \n Type = tolower(type),\n SkuName = tolower(skuName),\n Kind = tolower(kind),\n SubscriptionId = subscriptionId,\n Name = tolower(tostring(id)),\n State = tolower(state),\n Location = tolower(location),\n ResourceGroup = resourceGroup,\n Zones = tolower(tostring(zones)),\n AvailabilityZone = tolower(avZones),\n AvailabilitySet = tolower(avSets),\n Capacity = tolower(Capacity),\n FaultDomain = tolower(FaultDomain),\n OSDisk = tolower(OSDisk),\n ReadReplica = tolower(ReadReplica), \n AutomaticFailover = tolower(AutomaticFailover),\n MultipleWriteLocations = tolower(MultipleWriteLocations),\n StorageAutogrow = tolower(StorageAutogrow),\n ReplicationRole = tolower(ReplicationRole),\n Environment = environment,\n properties\n| join kind = leftouter (\n recoveryservicesresources\n | extend vmId = case(\n properties.backupManagementType == \"AzureIaasVM\", tolower(tostring(properties.dataSourceInfo.resourceID)),\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(properties.providerSpecificDetails.dataSourceInfo.resourceId)),\n ''\n )\n | extend asrId = iff(type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(strcat_array(array_slice(split(properties.recoveryFabricId, '/'), 0, 8), '/'))), '')\n | extend resourceId = case(\n properties.backupManagementType == \"AzureIaasVM\", vmId,\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", asrId,\n ''\n )\n | extend Backup = tostring(properties.protectionStatus)\n | extend replicationHealth = properties.replicationHealth\n | extend failoverHealth = properties.failoverHealth\n | extend protectionStateDescription = properties.protectionStateDescription\n | extend isReplicationAgentUpdateRequired = properties.providerSpecificDetails.isReplicationAgentUpdateRequired\n | project resourceId, vmId, asrId, Backup, replicationHealth, failoverHealth, protectionStateDescription, isReplicationAgentUpdateRequired\n )\n on $left.Name == $right.resourceId\n| extend Backup = case(\n Backup == \"Healthy\" or Backup == \"Unhealthy\", Backup,\n \"Unknown\")\n| extend Backup = case(\n (Type == 'microsoft.compute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == 'microsoft.classiccompute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == \"microsoft.compute/virtualmachinescalesets\"), \"Not Applicable\", \n (Type == \"microsoft.containerservice/managedclusters\"), \"Not Applicable\",\n (Type == 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (Type == 'microsoft.documentdb/databaseaccounts'), iif(properties.backupPolicy.type!=\"Continuous\",iif(properties.backupPolicy.periodicModeProperties.backupStorageRedundancy == \"Geo\", \"Geo\", \"Not Geo\"),\"Continuous\"),\n (Type == 'microsoft.dbformysql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbformysql/flexibleservers'), properties.backup.geoRedundantBackup,\n (Type == 'microsoft.dbforpostgresql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbforpostgresql/flexibleservers'), case(\n properties.backup.geoRedundantBackup == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Disabled\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.backup.geoRedundantBackup\n ),\n (Type contains \"storageaccounts\"), \"Not Applicable\",\n (Type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (Type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Unknown\"\n )\n| extend AvailabilitySet = case(\n AvailabilitySet == '-', 'None',\n isnotempty(AvailabilitySet), AvailabilitySet,\n \"Unknown\")\n\n| project Type, SkuName, Kind, SubscriptionId, Name, State, Location, ResourceGroup, Zones, AvailabilityZone, AvailabilitySet, Capacity, FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), Environment\n| where Type == 'microsoft.compute/virtualmachines'",
"size": 3,
"title": "Virtual Machines",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "$gen_group",
"formatter": 13,
"formatOptions": {
"linkTarget": "Resource",
"showIcon": true
}
},
{
"columnMatch": "Name",
"formatter": 5
},
{
"columnMatch": "SubscriptionId",
"formatter": 5
},
{
"columnMatch": "State",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "vm running",
"representation": "green",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "vm deallocated",
"representation": "gray",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "Location",
"formatter": 17
},
{
"columnMatch": "Zones",
"formatter": 5
},
{
"columnMatch": "AvailabilityZone",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "not configured",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "1",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "2",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "3",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "not applicable",
"representation": "more",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "configured",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "undefined",
"representation": "unknown",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "AvailabilitySet",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "undefined",
"representation": "unknown",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "not applicable",
"representation": "more",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "not configured",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "success",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "Capacity",
"formatter": 5
},
{
"columnMatch": "FaultDomain",
"formatter": 5
},
{
"columnMatch": "OSDisk",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "premium",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "ultra",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "ephemeral",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "standard",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "unmanaged",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "ReadReplica",
"formatter": 5
},
{
"columnMatch": "AutomaticFailover",
"formatter": 5
},
{
"columnMatch": "MultipleWriteLocations",
"formatter": 5
},
{
"columnMatch": "StorageAutogrow",
"formatter": 5
},
{
"columnMatch": "ReplicationRole",
"formatter": 5
},
{
"columnMatch": "Backup",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "healthy",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "unhealthy",
"representation": "3",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "not configured",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "Environment",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "Prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "SubscriptionName",
"formatter": 5
},
{
"columnMatch": "OSDisk_UltraorPremium",
"formatter": 5
},
{
"columnMatch": "OSDisk_Type",
"formatter": 5
}
],
"rowLimit": 10000,
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"SubscriptionId"
],
"expandTopLevel": false,
"finalBy": "Name"
}
},
"sortBy": []
},
"name": "kql_compute_vm_resources_details"
},
{
"type": 1,
"content": {
"json": "* Classic Virtual Machines are in path of retirement. Please migrate to Resource Manager based VMs immediately\r\n\r\n> Retirement announcement in the [docs](https://learn.microsoft.com/azure/virtual-machines/classic-vm-deprecation)",
"style": "warning"
},
"name": "classic-vm-retirement"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "resources\n| where resourceGroup in ({ResourceGroup})\n| extend environment = case(\n tags.Environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Environment)),\n tags.environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.environment)),\n tags.Env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Env)),\n tags.env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.env)),\n tolower(name) contains \"prod\", \"Production\",\n tolower(name) contains \"dev\", \"Development\",\n tolower(name) contains \"qa\", \"QA\",\n tolower(name) contains \"uat\", \"UAT\",\n tolower(name) contains \"sit\", \"SIT\",\n tolower(name) contains \"test\", \"Test\",\n \"Undefined\")\n| where environment in ({Environment})\n| join kind = inner(\n resources\n | extend tagName = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(bag_keys(tags)[0]))\n | extend tagValue = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags[tagName]))\n | distinct tagName,tagValue,id\n | where (('*' in (dynamic([{TagName}])) or tagName in (dynamic([{TagName}])))) and (('*' in (dynamic([{TagValue}])) or tagValue in (dynamic([{TagValue}]))))\n | distinct id\n)\non id\n| where \n (type == 'microsoft.compute/virtualmachines') or \n (type == 'microsoft.classiccompute/virtualmachines') or \n (type == \"microsoft.compute/virtualmachinescalesets\" and tags.aksEngineVersion !contains \"aks-gomod\") or\n (type == 'microsoft.web/sites') or \n (type == 'microsoft.web/serverfarms') or\n (type == \"microsoft.containerservice/managedclusters\") or \n (type == 'microsoft.sql/servers/databases') or \n (type == 'microsoft.documentdb/databaseaccounts') or \n (type == 'microsoft.dbformysql/servers') or \n (type == 'microsoft.dbformysql/flexibleservers') or\n (type == 'microsoft.dbforpostgresql/servers') or \n (type == 'microsoft.dbforpostgresql/flexibleservers') or \n (type == 'microsoft.cache/redis') or\n (type == \"microsoft.apimanagement/service\") or \n (type == \"microsoft.storage/storageaccounts\" or type == \"microsoft.classicstorage/storageaccounts\") or \n (type == \"microsoft.network/azurefirewalls\") or \n (type == \"microsoft.network/frontdoors\") or\n (type == \"microsoft.cdn/profiles\") or\n (type == \"microsoft.network/applicationgateways\") or \n (type == \"microsoft.network/loadbalancers\") or \n (type == \"microsoft.network/publicipaddresses\" or type == \"microsoft.network/publicipprefixes\") or \n (type == \"microsoft.network/virtualnetworkgateways\") or \n (type == \"microsoft.recoveryservices/vaults\")\n| join kind=leftouter (\n resources \n | where type == \"microsoft.containerservice/managedclusters\"\n // Expand per node pool to get using zone for all node pool\n | mv-expand agentPoolProfiles = properties.agentPoolProfiles\n | extend AvZones = agentPoolProfiles.availabilityZones\n | extend AksNodeResourceGroup = tolower(tostring(properties.nodeResourceGroup))\n // Get number of using zone per node pool VMSS. If it doesn't use any zone, return 0\n | extend useAvZone = case(\n array_length( AvZones ) \u003e 0, array_length( AvZones ), 0\n )\n | join kind=leftouter(\n resources\n | where type == 'microsoft.compute/virtualmachinescalesets'\n | extend resourceGroup = tolower(tostring(resourceGroup))\n | extend VmssCapacity = sku.capacity\n | extend vmssStorageAccountType = iff(\n properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType\n )\n ) on $left.AksNodeResourceGroup == $right.resourceGroup // Match AKS and VMSS with nodeResourceGroup\n | summarize AvZones=min(useAvZone), AksMinimumNodePoolCount=min(toint(VmssCapacity)), AksNodePoolStorageAccountType=make_set(vmssStorageAccountType), FaultDomainCount=min(toint(properties1.platformFaultDomainCount)) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), tostring(plan), tostring(properties), AksNodeResourceGroup\n | extend AksNodePoolStorageAccountType = iff(\n tolower(tostring(AksNodePoolStorageAccountType)) contains \"standard_lrs\", \"standard_lrs\", tolower(tostring(strcat_array(AksNodePoolStorageAccountType, \",\")))\n )\n // If there are some node pools within AKS cluster, it returns minimum number of zones. \n // If even one node pool is not using a zone, it will be \"Not Configured\".\n | extend AvZones = iff(tostring(AvZones) == \"0\", \"Not Configured\", tostring(AvZones)), AvSets = \"Scale Sets\"\n) on id\n// Start - Azure Load Balancer additional logic\n| mv-expand LbFeIpConfig = properties.frontendIPConfigurations\n| extend LbUseAvZone = iff(array_length(LbFeIpConfig.zones ) \u003e 0, array_length(LbFeIpConfig.zones ), 0)\n| extend LbIpType = iff(isnotnull(LbFeIpConfig.properties.publicIPAddress), \"Public\", \"Private\")\n//| summarize LbAvZones = min(LbUseAvZone) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), plan, tostring(properties)\n//| extend properties = todynamic(properties), sku = todynamic(sku), \n| summarize LbAvZones = arg_min(LbUseAvZone, *) by id\n// End - Azure Load Balancer additional logic\n| extend state = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.extended.instanceView.powerState.displayStatus),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.instanceView.powerState),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(properties.provisioningState),\n type == 'microsoft.web/sites', tostring(properties.state),\n type == 'microsoft.web/serverfarms', tostring(properties.status),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.provisioningState),\n type == 'microsoft.sql/servers/databases', tostring(properties.status),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.provisioningState),\n type == 'microsoft.dbformysql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbformysql/flexibleservers', tostring(properties.state),\n type == 'microsoft.dbforpostgresql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(properties.state),\n type == 'microsoft.cache/redis', tostring(properties.provisioningState),\n type == \"microsoft.apimanagement/service\", tostring(properties.provisioningState),\n type contains \"storageaccounts\", tostring(properties.provisioningState),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.provisioningState),\n type == \"microsoft.network/frontdoors\", tostring(properties.resourceState),\n type == \"microsoft.cdn/profiles\", tostring(properties.resourceState),\n type == \"microsoft.network/applicationgateways\", tostring(properties.operationalState),\n type == \"microsoft.network/loadbalancers\", tostring(properties.provisioningState),\n type contains \"publicip\", tostring(properties.provisioningState),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.provisioningState),\n type == \"microsoft.recoveryservices/vaults\", tostring(properties.provisioningState),\n \"Undefined\"\n )\n| extend skuName = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.hardwareProfile.vmSize),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.hardwareProfile.size),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.name),\n type == 'microsoft.web/sites', tostring(properties.sku),\n type == 'microsoft.web/serverfarms', tostring(sku.tier),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.agentPoolProfiles[0].vmSize),\n type == 'microsoft.sql/servers/databases', tostring(sku.tier),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.databaseAccountOfferType),\n type == 'microsoft.dbformysql/servers', tostring(sku.tier),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.cache/redis', tostring(properties.sku.name),\n type == \"microsoft.apimanagement/service\", tostring(sku.name),\n type contains 'storageaccounts', tostring(replace('-', '_', tostring(iff(type =~ \"microsoft.storage/storageaccounts\", sku.name, properties.accountType)))),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.sku.name),\n type == \"microsoft.network/frontdoors\", \"classic_frontdoor\",\n type == \"microsoft.cdn/profiles\", tostring(sku.name),\n type == \"microsoft.network/applicationgateways\", tostring(properties.sku.name),\n type == \"microsoft.network/loadbalancers\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type contains \"publicip\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.name),\n type == \"microsoft.recoveryservices/vaults\", tostring(iif(isnotnull(sku.tier), sku.tier, sku.name)),\n \"Undefined\"\n )\n| extend avZones = case(\n // reffer to: https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support\n location !in~ ('brazilsouth', 'canadacentral', 'centralus', 'eastus', 'eastus2', 'southcentralus', 'usgovvirginia', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachines'), coalesce(tostring(zones[0]), 'Not Configured'),\n (type == 'microsoft.classiccompute/virtualmachines'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachinescalesets'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == 'microsoft.containerservice/managedclusters' and AvZones \u003c\u003e \"\"), AvZones,\n (type == 'microsoft.containerservice/managedclusters' and isempty(AvZones)), \"Not Configured\",\n (type == 'microsoft.web/sites'), \"ASP AZ config\",\n (type == 'microsoft.web/serverfarms'), iff(properties.zoneRedundant == 'true', 'Configured', 'Not Configured'),\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), case( //SQL AZ SKU \u0026 region availability filter\n sku.tier == 'Basic' or sku.tier == 'Standard' or sku.name == 'System', 'Not Applicable',\n // Outside of these regions, SQL DB is not available in AZ. Refer to: https://learn.microsoft.com/en-us/azure/azure-sql/database/high-availability-sla?view=azuresql\u0026tabs=azure-powershell#general-purpose-service-tier-zone-redundant-availability\n sku.tier == 'GeneralPurpose' and location !in~ ('brazilsouth', 'eastus', 'eastus2', 'southcentralus', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n properties.zoneRedundant == 'true', 'Configured',\n 'Not Configured'\n ),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts'), iif(properties.locations[0].isZoneRedundant == \"false\", 'Not Configured', 'Configured'), \n (type == 'microsoft.dbformysql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.dbforpostgresql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole contains \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.cache/redis'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == \"microsoft.apimanagement/service\"), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type contains 'storageaccounts'), case(split(skuName, '_', 1)[0] contains \"zrs\", \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/azurefirewalls\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/loadbalancers\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n LbIpType =~ \"Public\", \"Public IP AZ Config\",\n tostring(LbAvZones) =~ \"0\", \"Not Configured\",\n tostring(LbAvZones)\n ),\n (type contains \"publicip\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n coalesce(tostring(array_length(parse_json(zones))), 'Not Configured')\n ),\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Public IP AZ Config\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend avSets = case(\n type == 'microsoft.compute/virtualmachines' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachines', (coalesce(extract('/availabilitySets/(.*)', 1, tostring(properties.availabilitySet.id)), 'Not Configured')),\n type == 'microsoft.classiccompute/virtualmachines', iff(isnotnull(properties.hardwareProfile.availabilitySet), 'Configured', 'Not Configured'),\n type == 'microsoft.compute/virtualmachinescalesets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', 'A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.',\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', case(\n AvSets == 'Scale Sets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n AvSets == 'Scale Sets', \"A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.\",\n \"Scale Sets Not Configured\"\n ),\n type == 'microsoft.sql/servers/databases', 'Not Applicable',\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', \"Not Applicable\",\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", tostring(properties.publicIPAddressVersion), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.gatewayType), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend Capacity = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.capacity),\n type == 'microsoft.web/sites', \"ASP Config\",\n type == 'microsoft.web/serverfarms', tostring(sku.capacity),\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(AksMinimumNodePoolCount), tostring(AksMinimumNodePoolCount), \"0\"), // AKS with or without VMSS\n type == 'microsoft.sql/servers/databases', tostring(sku.capacity),\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', tostring(sku.capacity),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.cache/redis', strcat(properties.sku.family, properties.sku.capacity),\n type == \"microsoft.apimanagement/service\", tostring(sku.capacity),\n type contains \"storageaccounts\", \"Not Applicable\", \n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", tostring(iif(isnotempty(properties.autoscaleConfiguration), properties.autoscaleConfiguration.minCapacity, properties.sku.capacity)),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", iif(type == \"microsoft.network/publicipprefixes\", \"PIP-prefix\", \"Single\"), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.capacity),\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend FaultDomain = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', iif(isnotempty(properties.platformFaultDomainCount), properties.platformFaultDomainCount, \"0\"), // 1 - AZ, 5 - Regional VMSS\n type == 'microsoft.web/sites', \"Not Applicable\",\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(tostring(FaultDomainCount)), tostring(FaultDomainCount), \"0\"),\n type == 'microsoft.sql/servers/databases', \"Not Applicable\",\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\" and properties.vpnType == \"PolicyBased\", \"ErPolicyBased\", tostring(properties.vpnType)), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend osDisk = case(\n type == 'microsoft.compute/virtualmachines', iif(properties.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.classiccompute/virtualmachines', 'Classic',\n type == 'microsoft.compute/virtualmachinescalesets', iif(properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', AksNodePoolStorageAccountType,\n type == 'microsoft.sql/servers/databases', properties.currentBackupStorageRedundancy,\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.platformVersion), //Field Override\n type contains \"storageaccounts\", tostring(split(skuName, '_', 0)[0]),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", tostring(LbIpType), //Field Override\n type contains \"publicip\", tostring(properties.publicIPAllocationMethod), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.vpnGatewayGeneration), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n 'Not Applicable'\n )\n| extend OSDisk = case(\n isnotempty(osDisk), osDisk,\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and state \u003c\u003e 'VM running', 'Unknown, start VM to get disk information.',\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and isnotempty(properties.storageProfile.osDisk.vhd.uri), 'Unmanaged',\n \"Unknown\")\n| extend ReadReplica = case (\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), tostring(properties.readReplicaCount), // SQL DB\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\", // Synapse\n type == 'microsoft.documentdb/databaseaccounts', tostring(array_length(parse_json(properties.readLocations))),\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.additionalLocations),\n type contains \"storageaccounts\", case(\n // Use the following query to get 3+0 regions: az account list-locations -o table --query '[?availabilityZoneMappings \u0026\u0026 (!metadata.pairedRegion || length(metadata.pairedRegion) == `0`)]'\n location in~ ('qatarcentral', 'polandcentral', 'israelcentral', 'italynorth') and split(skuName, '_', 1)[0] startswith \"zrs\" , 'Configured',\n split(skuName, '_', 1)[0] startswith \"ra\", \"Configured\",\n \"Not Configured\"\n ),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\", \"Not Applicable\", tostring(properties.activeActive)), //Field Override,\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend AutomaticFailover = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"false\" and properties.enableMultipleWriteLocations == \"false\" and toint(ReadReplica) \u003e 1), \"Not Configured\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"true\"), \"Configured\",\n (type == 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', case(\n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole != \"Replica\" , \"Not Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', case( \n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Not Configured\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbformysql/flexibleservers', case(properties.haEnabled == \"Enabled\", \"Configured\", \"Not Applicable\"),\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", iif(isnotempty(properties.autoscaleConfiguration), \"Configured\", \"Not Configured\"),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", \"Not Applicable\",\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend MultipleWriteLocations = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.dbformysql/servers', 'microsoft.dbformysql/flexibleservers', 'microsoft.dbforpostgresql/servers', 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"false\"), \"Not Enabled\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"true\"), \"Enabled\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend StorageAutogrow = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbformysql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend ReplicationRole = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), iif(isnotempty(properties.secondaryType), \"replica\", \"master\"),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbformysql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), tostring(split(skuName, '_', 1)[0]),\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| project \n Type = tolower(type),\n SkuName = tolower(skuName),\n Kind = tolower(kind),\n SubscriptionId = subscriptionId,\n Name = tolower(tostring(id)),\n State = tolower(state),\n Location = tolower(location),\n ResourceGroup = resourceGroup,\n Zones = tolower(tostring(zones)),\n AvailabilityZone = tolower(avZones),\n AvailabilitySet = tolower(avSets),\n Capacity = tolower(Capacity),\n FaultDomain = tolower(FaultDomain),\n OSDisk = tolower(OSDisk),\n ReadReplica = tolower(ReadReplica), \n AutomaticFailover = tolower(AutomaticFailover),\n MultipleWriteLocations = tolower(MultipleWriteLocations),\n StorageAutogrow = tolower(StorageAutogrow),\n ReplicationRole = tolower(ReplicationRole),\n Environment = environment,\n properties\n| join kind = leftouter (\n recoveryservicesresources\n | extend vmId = case(\n properties.backupManagementType == \"AzureIaasVM\", tolower(tostring(properties.dataSourceInfo.resourceID)),\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(properties.providerSpecificDetails.dataSourceInfo.resourceId)),\n ''\n )\n | extend asrId = iff(type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(strcat_array(array_slice(split(properties.recoveryFabricId, '/'), 0, 8), '/'))), '')\n | extend resourceId = case(\n properties.backupManagementType == \"AzureIaasVM\", vmId,\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", asrId,\n ''\n )\n | extend Backup = tostring(properties.protectionStatus)\n | extend replicationHealth = properties.replicationHealth\n | extend failoverHealth = properties.failoverHealth\n | extend protectionStateDescription = properties.protectionStateDescription\n | extend isReplicationAgentUpdateRequired = properties.providerSpecificDetails.isReplicationAgentUpdateRequired\n | project resourceId, vmId, asrId, Backup, replicationHealth, failoverHealth, protectionStateDescription, isReplicationAgentUpdateRequired\n )\n on $left.Name == $right.resourceId\n| extend Backup = case(\n Backup == \"Healthy\" or Backup == \"Unhealthy\", Backup,\n \"Unknown\")\n| extend Backup = case(\n (Type == 'microsoft.compute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == 'microsoft.classiccompute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == \"microsoft.compute/virtualmachinescalesets\"), \"Not Applicable\", \n (Type == \"microsoft.containerservice/managedclusters\"), \"Not Applicable\",\n (Type == 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (Type == 'microsoft.documentdb/databaseaccounts'), iif(properties.backupPolicy.type!=\"Continuous\",iif(properties.backupPolicy.periodicModeProperties.backupStorageRedundancy == \"Geo\", \"Geo\", \"Not Geo\"),\"Continuous\"),\n (Type == 'microsoft.dbformysql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbformysql/flexibleservers'), properties.backup.geoRedundantBackup,\n (Type == 'microsoft.dbforpostgresql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbforpostgresql/flexibleservers'), case(\n properties.backup.geoRedundantBackup == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Disabled\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.backup.geoRedundantBackup\n ),\n (Type contains \"storageaccounts\"), \"Not Applicable\",\n (Type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (Type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Unknown\"\n )\n| extend AvailabilitySet = case(\n AvailabilitySet == '-', 'None',\n isnotempty(AvailabilitySet), AvailabilitySet,\n \"Unknown\")\n\n| project Type, SkuName, Kind, SubscriptionId, Name, State, Location, ResourceGroup, Zones, AvailabilityZone, AvailabilitySet, Capacity, FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), Environment\n| where Type == 'microsoft.classiccompute/virtualmachines'",
"size": 3,
"title": "Classic Virtual Machines",
"noDataMessage": "No classic VMs found",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "$gen_group",
"formatter": 13,
"formatOptions": {
"linkTarget": "Resource",
"showIcon": true
}
},
{
"columnMatch": "Type",
"formatter": 5
},
{
"columnMatch": "Kind",
"formatter": 5
},
{
"columnMatch": "SubscriptionId",
"formatter": 5
},
{
"columnMatch": "Name",
"formatter": 5
},
{
"columnMatch": "Location",
"formatter": 17
},
{
"columnMatch": "Zones",
"formatter": 5
},
{
"columnMatch": "AvailabilityZone",
"formatter": 5
},
{
"columnMatch": "Capacity",
"formatter": 5
},
{
"columnMatch": "FaultDomain",
"formatter": 5
},
{
"columnMatch": "ReadReplica",
"formatter": 5
},
{
"columnMatch": "AutomaticFailover",
"formatter": 5
},
{
"columnMatch": "MultipleWriteLocations",
"formatter": 5
},
{
"columnMatch": "StorageAutogrow",
"formatter": 5
},
{
"columnMatch": "ReplicationRole",
"formatter": 5
},
{
"columnMatch": "Environment",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "Prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "subscriptionId",
"formatter": 5
}
],
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"SubscriptionId"
],
"finalBy": "Name"
},
"labelSettings": [
{
"columnId": "SubscriptionId",
"label": "Subscription"
}
]
}
},
"name": "Classic VM"
}
]
},
"conditionalVisibility": {
"parameterName": "selectedTab",
"comparison": "isEqualTo",
"value": "cVM"
},
"name": "cVMsGroup"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 1,
"content": {
"json": "[SLA for Virtual Machine Scale Sets](https://azure.microsoft.com/support/legal/sla/virtual-machine-scale-sets/)\r\n* Virtual Machine Scale Sets is a free service, therefore, it does not have a financially backed SLA itself. However, if the Virtual Machine Scale Sets includes Virtual Machines in at least 2 Fault Domains, the availability of the underlying Virtual Machines SLA for two or more instances applies.\r\n* If the scale set contains a single Virtual Machine, the availability for a Single Instance Virtual Machine applies. See the [Virtual Machines SLA](https://azure.microsoft.com/support/legal/sla/virtual-machines/) for more details.\r\n\r\n> SLA accurate at time of release. Latest information is available [here](https://azure.microsoft.com/support/legal/sla/virtual-machine-scale-sets/)",
"style": "upsell"
},
"conditionalVisibility": {
"parameterName": "SLA",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 2"
},
{
"type": 1,
"content": {
"json": "[Virtual machine scale set resiliency checklist](https://learn.microsoft.com/azure/architecture/checklist/resiliency-per-service#virtual-machines)\r\n\r\n* Avoid running a production workload on a single VM in a Scale set. A single VM deployment is not resilient to planned or unplanned maintenance. Instead, put multiple VMs in a virtual machine scale set, with a load balancer in front.\r\n* Put each application tier into a separate Scale Set. In an N-tier application, don't put VMs from different tiers into the same scale set. \r\n* Make sure to select multiple fault domains for the scale set to achieve resiliency during failures.\r\n* Always enable Zone redundancy for VMs in scale sets whenever the region support zone redundancy\r\n* Enable Overprovision settings to create multiple VMs during scaling and remove failure VMs. This increases chances of successful provision during scaling event.\r\n* Choose the right VM size based on performance requirements. When moving an existing workload to Azure, start with the VM size that's the closest match to your on-premises servers. Then measure the performance of your actual workload with respect to CPU, memory, and disk IOPS, and adjust the size if needed. This helps to ensure the application behaves as expected in a cloud environment. Also, if you need multiple NICs, be aware of the NIC limit for each size.\r\n* Use managed disks for VHDs. Managed disks provide better reliability for VMs in an availability set, because the disks are sufficiently isolated from each other to avoid single points of failure. Also, managed disks aren't subject to the IOPS limits of VHDs created in a storage account.\r\n* Configure Azure Monitor. Collect and analyze monitoring data from Azure virtual machines including the guest operating system and the workloads that run in it.\r\n* VMs have to be running for disk information to be available.\r\n* VM SLAs apply to both operating system and data disks - only operating system disks are represented in this workbook.\r\n* Capacity specifies the number of virtual machines in the scale set.\r\n\r\n\r\n> Azure generally recommends to leverage [Availability Zone](https://learn.microsoft.com/azure/availability-zones/az-overview) for better High Availability within the region by leveraging multiple zones inside region. By architecting your solutions to use replicated services in zones, you can protect your apps and data from the loss of a datacenter. \r\n\r\n> At this point, not all Azure regions and services support Availability Zones, the support matrix can be found [here](https://learn.microsoft.com/azure/availability-zones/az-region). Whenerver there is a Zonal recommendation for a particular service from this workbook, please note that that is applicable only for the regions supporting Availability Zones from the earlier list.",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "Help",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 3"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "resources\n| where resourceGroup in ({ResourceGroup})\n| extend environment = case(\n tags.Environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Environment)),\n tags.environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.environment)),\n tags.Env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Env)),\n tags.env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.env)),\n tolower(name) contains \"prod\", \"Production\",\n tolower(name) contains \"dev\", \"Development\",\n tolower(name) contains \"qa\", \"QA\",\n tolower(name) contains \"uat\", \"UAT\",\n tolower(name) contains \"sit\", \"SIT\",\n tolower(name) contains \"test\", \"Test\",\n \"Undefined\")\n| where environment in ({Environment})\n| join kind = inner(\n resources\n | extend tagName = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(bag_keys(tags)[0]))\n | extend tagValue = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags[tagName]))\n | distinct tagName,tagValue,id\n | where (('*' in (dynamic([{TagName}])) or tagName in (dynamic([{TagName}])))) and (('*' in (dynamic([{TagValue}])) or tagValue in (dynamic([{TagValue}]))))\n | distinct id\n)\non id\n| where \n (type == 'microsoft.compute/virtualmachines') or \n (type == 'microsoft.classiccompute/virtualmachines') or \n (type == \"microsoft.compute/virtualmachinescalesets\" and tags.aksEngineVersion !contains \"aks-gomod\") or\n (type == 'microsoft.web/sites') or \n (type == 'microsoft.web/serverfarms') or\n (type == \"microsoft.containerservice/managedclusters\") or \n (type == 'microsoft.sql/servers/databases') or \n (type == 'microsoft.documentdb/databaseaccounts') or \n (type == 'microsoft.dbformysql/servers') or \n (type == 'microsoft.dbformysql/flexibleservers') or\n (type == 'microsoft.dbforpostgresql/servers') or \n (type == 'microsoft.dbforpostgresql/flexibleservers') or \n (type == 'microsoft.cache/redis') or\n (type == \"microsoft.apimanagement/service\") or \n (type == \"microsoft.storage/storageaccounts\" or type == \"microsoft.classicstorage/storageaccounts\") or \n (type == \"microsoft.network/azurefirewalls\") or \n (type == \"microsoft.network/frontdoors\") or\n (type == \"microsoft.cdn/profiles\") or\n (type == \"microsoft.network/applicationgateways\") or \n (type == \"microsoft.network/loadbalancers\") or \n (type == \"microsoft.network/publicipaddresses\" or type == \"microsoft.network/publicipprefixes\") or \n (type == \"microsoft.network/virtualnetworkgateways\") or \n (type == \"microsoft.recoveryservices/vaults\")\n| join kind=leftouter (\n resources \n | where type == \"microsoft.containerservice/managedclusters\"\n // Expand per node pool to get using zone for all node pool\n | mv-expand agentPoolProfiles = properties.agentPoolProfiles\n | extend AvZones = agentPoolProfiles.availabilityZones\n | extend AksNodeResourceGroup = tolower(tostring(properties.nodeResourceGroup))\n // Get number of using zone per node pool VMSS. If it doesn't use any zone, return 0\n | extend useAvZone = case(\n array_length( AvZones ) \u003e 0, array_length( AvZones ), 0\n )\n | join kind=leftouter(\n resources\n | where type == 'microsoft.compute/virtualmachinescalesets'\n | extend resourceGroup = tolower(tostring(resourceGroup))\n | extend VmssCapacity = sku.capacity\n | extend vmssStorageAccountType = iff(\n properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType\n )\n ) on $left.AksNodeResourceGroup == $right.resourceGroup // Match AKS and VMSS with nodeResourceGroup\n | summarize AvZones=min(useAvZone), AksMinimumNodePoolCount=min(toint(VmssCapacity)), AksNodePoolStorageAccountType=make_set(vmssStorageAccountType), FaultDomainCount=min(toint(properties1.platformFaultDomainCount)) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), tostring(plan), tostring(properties), AksNodeResourceGroup\n | extend AksNodePoolStorageAccountType = iff(\n tolower(tostring(AksNodePoolStorageAccountType)) contains \"standard_lrs\", \"standard_lrs\", tolower(tostring(strcat_array(AksNodePoolStorageAccountType, \",\")))\n )\n // If there are some node pools within AKS cluster, it returns minimum number of zones. \n // If even one node pool is not using a zone, it will be \"Not Configured\".\n | extend AvZones = iff(tostring(AvZones) == \"0\", \"Not Configured\", tostring(AvZones)), AvSets = \"Scale Sets\"\n) on id\n// Start - Azure Load Balancer additional logic\n| mv-expand LbFeIpConfig = properties.frontendIPConfigurations\n| extend LbUseAvZone = iff(array_length(LbFeIpConfig.zones ) \u003e 0, array_length(LbFeIpConfig.zones ), 0)\n| extend LbIpType = iff(isnotnull(LbFeIpConfig.properties.publicIPAddress), \"Public\", \"Private\")\n//| summarize LbAvZones = min(LbUseAvZone) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), plan, tostring(properties)\n//| extend properties = todynamic(properties), sku = todynamic(sku), \n| summarize LbAvZones = arg_min(LbUseAvZone, *) by id\n// End - Azure Load Balancer additional logic\n| extend state = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.extended.instanceView.powerState.displayStatus),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.instanceView.powerState),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(properties.provisioningState),\n type == 'microsoft.web/sites', tostring(properties.state),\n type == 'microsoft.web/serverfarms', tostring(properties.status),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.provisioningState),\n type == 'microsoft.sql/servers/databases', tostring(properties.status),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.provisioningState),\n type == 'microsoft.dbformysql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbformysql/flexibleservers', tostring(properties.state),\n type == 'microsoft.dbforpostgresql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(properties.state),\n type == 'microsoft.cache/redis', tostring(properties.provisioningState),\n type == \"microsoft.apimanagement/service\", tostring(properties.provisioningState),\n type contains \"storageaccounts\", tostring(properties.provisioningState),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.provisioningState),\n type == \"microsoft.network/frontdoors\", tostring(properties.resourceState),\n type == \"microsoft.cdn/profiles\", tostring(properties.resourceState),\n type == \"microsoft.network/applicationgateways\", tostring(properties.operationalState),\n type == \"microsoft.network/loadbalancers\", tostring(properties.provisioningState),\n type contains \"publicip\", tostring(properties.provisioningState),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.provisioningState),\n type == \"microsoft.recoveryservices/vaults\", tostring(properties.provisioningState),\n \"Undefined\"\n )\n| extend skuName = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.hardwareProfile.vmSize),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.hardwareProfile.size),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.name),\n type == 'microsoft.web/sites', tostring(properties.sku),\n type == 'microsoft.web/serverfarms', tostring(sku.tier),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.agentPoolProfiles[0].vmSize),\n type == 'microsoft.sql/servers/databases', tostring(sku.tier),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.databaseAccountOfferType),\n type == 'microsoft.dbformysql/servers', tostring(sku.tier),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.cache/redis', tostring(properties.sku.name),\n type == \"microsoft.apimanagement/service\", tostring(sku.name),\n type contains 'storageaccounts', tostring(replace('-', '_', tostring(iff(type =~ \"microsoft.storage/storageaccounts\", sku.name, properties.accountType)))),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.sku.name),\n type == \"microsoft.network/frontdoors\", \"classic_frontdoor\",\n type == \"microsoft.cdn/profiles\", tostring(sku.name),\n type == \"microsoft.network/applicationgateways\", tostring(properties.sku.name),\n type == \"microsoft.network/loadbalancers\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type contains \"publicip\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.name),\n type == \"microsoft.recoveryservices/vaults\", tostring(iif(isnotnull(sku.tier), sku.tier, sku.name)),\n \"Undefined\"\n )\n| extend avZones = case(\n // reffer to: https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support\n location !in~ ('brazilsouth', 'canadacentral', 'centralus', 'eastus', 'eastus2', 'southcentralus', 'usgovvirginia', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachines'), coalesce(tostring(zones[0]), 'Not Configured'),\n (type == 'microsoft.classiccompute/virtualmachines'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachinescalesets'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == 'microsoft.containerservice/managedclusters' and AvZones \u003c\u003e \"\"), AvZones,\n (type == 'microsoft.containerservice/managedclusters' and isempty(AvZones)), \"Not Configured\",\n (type == 'microsoft.web/sites'), \"ASP AZ config\",\n (type == 'microsoft.web/serverfarms'), iff(properties.zoneRedundant == 'true', 'Configured', 'Not Configured'),\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), case( //SQL AZ SKU \u0026 region availability filter\n sku.tier == 'Basic' or sku.tier == 'Standard' or sku.name == 'System', 'Not Applicable',\n // Outside of these regions, SQL DB is not available in AZ. Refer to: https://learn.microsoft.com/en-us/azure/azure-sql/database/high-availability-sla?view=azuresql\u0026tabs=azure-powershell#general-purpose-service-tier-zone-redundant-availability\n sku.tier == 'GeneralPurpose' and location !in~ ('brazilsouth', 'eastus', 'eastus2', 'southcentralus', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n properties.zoneRedundant == 'true', 'Configured',\n 'Not Configured'\n ),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts'), iif(properties.locations[0].isZoneRedundant == \"false\", 'Not Configured', 'Configured'), \n (type == 'microsoft.dbformysql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.dbforpostgresql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole contains \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.cache/redis'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == \"microsoft.apimanagement/service\"), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type contains 'storageaccounts'), case(split(skuName, '_', 1)[0] contains \"zrs\", \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/azurefirewalls\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/loadbalancers\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n LbIpType =~ \"Public\", \"Public IP AZ Config\",\n tostring(LbAvZones) =~ \"0\", \"Not Configured\",\n tostring(LbAvZones)\n ),\n (type contains \"publicip\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n coalesce(tostring(array_length(parse_json(zones))), 'Not Configured')\n ),\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Public IP AZ Config\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend avSets = case(\n type == 'microsoft.compute/virtualmachines' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachines', (coalesce(extract('/availabilitySets/(.*)', 1, tostring(properties.availabilitySet.id)), 'Not Configured')),\n type == 'microsoft.classiccompute/virtualmachines', iff(isnotnull(properties.hardwareProfile.availabilitySet), 'Configured', 'Not Configured'),\n type == 'microsoft.compute/virtualmachinescalesets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', 'A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.',\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', case(\n AvSets == 'Scale Sets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n AvSets == 'Scale Sets', \"A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.\",\n \"Scale Sets Not Configured\"\n ),\n type == 'microsoft.sql/servers/databases', 'Not Applicable',\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', \"Not Applicable\",\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", tostring(properties.publicIPAddressVersion), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.gatewayType), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend Capacity = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.capacity),\n type == 'microsoft.web/sites', \"ASP Config\",\n type == 'microsoft.web/serverfarms', tostring(sku.capacity),\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(AksMinimumNodePoolCount), tostring(AksMinimumNodePoolCount), \"0\"), // AKS with or without VMSS\n type == 'microsoft.sql/servers/databases', tostring(sku.capacity),\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', tostring(sku.capacity),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.cache/redis', strcat(properties.sku.family, properties.sku.capacity),\n type == \"microsoft.apimanagement/service\", tostring(sku.capacity),\n type contains \"storageaccounts\", \"Not Applicable\", \n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", tostring(iif(isnotempty(properties.autoscaleConfiguration), properties.autoscaleConfiguration.minCapacity, properties.sku.capacity)),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", iif(type == \"microsoft.network/publicipprefixes\", \"PIP-prefix\", \"Single\"), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.capacity),\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend FaultDomain = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', iif(isnotempty(properties.platformFaultDomainCount), properties.platformFaultDomainCount, \"0\"), // 1 - AZ, 5 - Regional VMSS\n type == 'microsoft.web/sites', \"Not Applicable\",\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(tostring(FaultDomainCount)), tostring(FaultDomainCount), \"0\"),\n type == 'microsoft.sql/servers/databases', \"Not Applicable\",\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\" and properties.vpnType == \"PolicyBased\", \"ErPolicyBased\", tostring(properties.vpnType)), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend osDisk = case(\n type == 'microsoft.compute/virtualmachines', iif(properties.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.classiccompute/virtualmachines', 'Classic',\n type == 'microsoft.compute/virtualmachinescalesets', iif(properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', AksNodePoolStorageAccountType,\n type == 'microsoft.sql/servers/databases', properties.currentBackupStorageRedundancy,\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.platformVersion), //Field Override\n type contains \"storageaccounts\", tostring(split(skuName, '_', 0)[0]),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", tostring(LbIpType), //Field Override\n type contains \"publicip\", tostring(properties.publicIPAllocationMethod), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.vpnGatewayGeneration), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n 'Not Applicable'\n )\n| extend OSDisk = case(\n isnotempty(osDisk), osDisk,\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and state \u003c\u003e 'VM running', 'Unknown, start VM to get disk information.',\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and isnotempty(properties.storageProfile.osDisk.vhd.uri), 'Unmanaged',\n \"Unknown\")\n| extend ReadReplica = case (\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), tostring(properties.readReplicaCount), // SQL DB\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\", // Synapse\n type == 'microsoft.documentdb/databaseaccounts', tostring(array_length(parse_json(properties.readLocations))),\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.additionalLocations),\n type contains \"storageaccounts\", case(\n // Use the following query to get 3+0 regions: az account list-locations -o table --query '[?availabilityZoneMappings \u0026\u0026 (!metadata.pairedRegion || length(metadata.pairedRegion) == `0`)]'\n location in~ ('qatarcentral', 'polandcentral', 'israelcentral', 'italynorth') and split(skuName, '_', 1)[0] startswith \"zrs\" , 'Configured',\n split(skuName, '_', 1)[0] startswith \"ra\", \"Configured\",\n \"Not Configured\"\n ),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\", \"Not Applicable\", tostring(properties.activeActive)), //Field Override,\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend AutomaticFailover = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"false\" and properties.enableMultipleWriteLocations == \"false\" and toint(ReadReplica) \u003e 1), \"Not Configured\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"true\"), \"Configured\",\n (type == 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', case(\n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole != \"Replica\" , \"Not Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', case( \n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Not Configured\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbformysql/flexibleservers', case(properties.haEnabled == \"Enabled\", \"Configured\", \"Not Applicable\"),\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", iif(isnotempty(properties.autoscaleConfiguration), \"Configured\", \"Not Configured\"),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", \"Not Applicable\",\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend MultipleWriteLocations = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.dbformysql/servers', 'microsoft.dbformysql/flexibleservers', 'microsoft.dbforpostgresql/servers', 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"false\"), \"Not Enabled\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"true\"), \"Enabled\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend StorageAutogrow = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbformysql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend ReplicationRole = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), iif(isnotempty(properties.secondaryType), \"replica\", \"master\"),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbformysql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), tostring(split(skuName, '_', 1)[0]),\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| project \n Type = tolower(type),\n SkuName = tolower(skuName),\n Kind = tolower(kind),\n SubscriptionId = subscriptionId,\n Name = tolower(tostring(id)),\n State = tolower(state),\n Location = tolower(location),\n ResourceGroup = resourceGroup,\n Zones = tolower(tostring(zones)),\n AvailabilityZone = tolower(avZones),\n AvailabilitySet = tolower(avSets),\n Capacity = tolower(Capacity),\n FaultDomain = tolower(FaultDomain),\n OSDisk = tolower(OSDisk),\n ReadReplica = tolower(ReadReplica), \n AutomaticFailover = tolower(AutomaticFailover),\n MultipleWriteLocations = tolower(MultipleWriteLocations),\n StorageAutogrow = tolower(StorageAutogrow),\n ReplicationRole = tolower(ReplicationRole),\n Environment = environment,\n properties\n| join kind = leftouter (\n recoveryservicesresources\n | extend vmId = case(\n properties.backupManagementType == \"AzureIaasVM\", tolower(tostring(properties.dataSourceInfo.resourceID)),\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(properties.providerSpecificDetails.dataSourceInfo.resourceId)),\n ''\n )\n | extend asrId = iff(type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(strcat_array(array_slice(split(properties.recoveryFabricId, '/'), 0, 8), '/'))), '')\n | extend resourceId = case(\n properties.backupManagementType == \"AzureIaasVM\", vmId,\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", asrId,\n ''\n )\n | extend Backup = tostring(properties.protectionStatus)\n | extend replicationHealth = properties.replicationHealth\n | extend failoverHealth = properties.failoverHealth\n | extend protectionStateDescription = properties.protectionStateDescription\n | extend isReplicationAgentUpdateRequired = properties.providerSpecificDetails.isReplicationAgentUpdateRequired\n | project resourceId, vmId, asrId, Backup, replicationHealth, failoverHealth, protectionStateDescription, isReplicationAgentUpdateRequired\n )\n on $left.Name == $right.resourceId\n| extend Backup = case(\n Backup == \"Healthy\" or Backup == \"Unhealthy\", Backup,\n \"Unknown\")\n| extend Backup = case(\n (Type == 'microsoft.compute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == 'microsoft.classiccompute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == \"microsoft.compute/virtualmachinescalesets\"), \"Not Applicable\", \n (Type == \"microsoft.containerservice/managedclusters\"), \"Not Applicable\",\n (Type == 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (Type == 'microsoft.documentdb/databaseaccounts'), iif(properties.backupPolicy.type!=\"Continuous\",iif(properties.backupPolicy.periodicModeProperties.backupStorageRedundancy == \"Geo\", \"Geo\", \"Not Geo\"),\"Continuous\"),\n (Type == 'microsoft.dbformysql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbformysql/flexibleservers'), properties.backup.geoRedundantBackup,\n (Type == 'microsoft.dbforpostgresql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbforpostgresql/flexibleservers'), case(\n properties.backup.geoRedundantBackup == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Disabled\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.backup.geoRedundantBackup\n ),\n (Type contains \"storageaccounts\"), \"Not Applicable\",\n (Type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (Type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Unknown\"\n )\n| extend AvailabilitySet = case(\n AvailabilitySet == '-', 'None',\n isnotempty(AvailabilitySet), AvailabilitySet,\n \"Unknown\")\n\n| project Type, SkuName, Kind, SubscriptionId, Name, State, Location, ResourceGroup, Zones, AvailabilityZone, AvailabilitySet, Capacity, FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), Environment\n| where Type == 'microsoft.compute/virtualmachinescalesets'\n| summarize ResourceTotal=count(Name), NotSucceeded=dcountif(Name, State != \"succeeded\"), NoAVZone=dcountif(Name, AvailabilityZone == \"not configured\"), CapacityLt2=dcountif(Name, (Capacity == \"0\" or Capacity == \"1\")), NoFaultDomain=dcountif(Name, (FaultDomain != \"1\" and FaultDomain != \"5\")), OSDiskRecommendation=dcountif(Name, (OSDisk != \"premium_lrs\" and OSDisk != \"ephemeral\"))",
"size": 3,
"title": "Virtual Machine Scale Sets - Recommendation Summary",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"rowLimit": 10000,
"formatters": [
{
"columnMatch": "ResourceTotal",
"formatter": 22,
"formatOptions": {
"compositeBarSettings": {
"labelText": "",
"columnSettings": [
{
"columnName": "NotSucceeded",
"color": "lightBlue"
},
{
"columnName": "NoAVZone",
"color": "orange"
},
{
"columnName": "CapacityLt2",
"color": "purple"
},
{
"columnName": "NoFaultDomain",
"color": "redBright"
},
{
"columnName": "OSDiskRecommendation",
"color": "yellow"
}
]
}
}
}
],
"labelSettings": [
{
"columnId": "ResourceTotal",
"label": "Resource Total"
},
{
"columnId": "NotSucceeded",
"label": "VMSS Not Succeeded"
},
{
"columnId": "NoAVZone",
"label": "No Availability Zone"
},
{
"columnId": "CapacityLt2",
"label": "Capacity < 2"
},
{
"columnId": "NoFaultDomain",
"label": "No Fault Domain"
},
{
"columnId": "OSDiskRecommendation",
"label": "OS Disk Recommendation"
}
]
},
"sortBy": []
},
"name": "kql_compute_vmss_resources_details_summary"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "resources\n| where resourceGroup in ({ResourceGroup})\n| extend environment = case(\n tags.Environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Environment)),\n tags.environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.environment)),\n tags.Env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Env)),\n tags.env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.env)),\n tolower(name) contains \"prod\", \"Production\",\n tolower(name) contains \"dev\", \"Development\",\n tolower(name) contains \"qa\", \"QA\",\n tolower(name) contains \"uat\", \"UAT\",\n tolower(name) contains \"sit\", \"SIT\",\n tolower(name) contains \"test\", \"Test\",\n \"Undefined\")\n| where environment in ({Environment})\n| join kind = inner(\n resources\n | extend tagName = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(bag_keys(tags)[0]))\n | extend tagValue = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags[tagName]))\n | distinct tagName,tagValue,id\n | where (('*' in (dynamic([{TagName}])) or tagName in (dynamic([{TagName}])))) and (('*' in (dynamic([{TagValue}])) or tagValue in (dynamic([{TagValue}]))))\n | distinct id\n)\non id\n| where \n (type == 'microsoft.compute/virtualmachines') or \n (type == 'microsoft.classiccompute/virtualmachines') or \n (type == \"microsoft.compute/virtualmachinescalesets\" and tags.aksEngineVersion !contains \"aks-gomod\") or\n (type == 'microsoft.web/sites') or \n (type == 'microsoft.web/serverfarms') or\n (type == \"microsoft.containerservice/managedclusters\") or \n (type == 'microsoft.sql/servers/databases') or \n (type == 'microsoft.documentdb/databaseaccounts') or \n (type == 'microsoft.dbformysql/servers') or \n (type == 'microsoft.dbformysql/flexibleservers') or\n (type == 'microsoft.dbforpostgresql/servers') or \n (type == 'microsoft.dbforpostgresql/flexibleservers') or \n (type == 'microsoft.cache/redis') or\n (type == \"microsoft.apimanagement/service\") or \n (type == \"microsoft.storage/storageaccounts\" or type == \"microsoft.classicstorage/storageaccounts\") or \n (type == \"microsoft.network/azurefirewalls\") or \n (type == \"microsoft.network/frontdoors\") or\n (type == \"microsoft.cdn/profiles\") or\n (type == \"microsoft.network/applicationgateways\") or \n (type == \"microsoft.network/loadbalancers\") or \n (type == \"microsoft.network/publicipaddresses\" or type == \"microsoft.network/publicipprefixes\") or \n (type == \"microsoft.network/virtualnetworkgateways\") or \n (type == \"microsoft.recoveryservices/vaults\")\n| join kind=leftouter (\n resources \n | where type == \"microsoft.containerservice/managedclusters\"\n // Expand per node pool to get using zone for all node pool\n | mv-expand agentPoolProfiles = properties.agentPoolProfiles\n | extend AvZones = agentPoolProfiles.availabilityZones\n | extend AksNodeResourceGroup = tolower(tostring(properties.nodeResourceGroup))\n // Get number of using zone per node pool VMSS. If it doesn't use any zone, return 0\n | extend useAvZone = case(\n array_length( AvZones ) \u003e 0, array_length( AvZones ), 0\n )\n | join kind=leftouter(\n resources\n | where type == 'microsoft.compute/virtualmachinescalesets'\n | extend resourceGroup = tolower(tostring(resourceGroup))\n | extend VmssCapacity = sku.capacity\n | extend vmssStorageAccountType = iff(\n properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType\n )\n ) on $left.AksNodeResourceGroup == $right.resourceGroup // Match AKS and VMSS with nodeResourceGroup\n | summarize AvZones=min(useAvZone), AksMinimumNodePoolCount=min(toint(VmssCapacity)), AksNodePoolStorageAccountType=make_set(vmssStorageAccountType), FaultDomainCount=min(toint(properties1.platformFaultDomainCount)) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), tostring(plan), tostring(properties), AksNodeResourceGroup\n | extend AksNodePoolStorageAccountType = iff(\n tolower(tostring(AksNodePoolStorageAccountType)) contains \"standard_lrs\", \"standard_lrs\", tolower(tostring(strcat_array(AksNodePoolStorageAccountType, \",\")))\n )\n // If there are some node pools within AKS cluster, it returns minimum number of zones. \n // If even one node pool is not using a zone, it will be \"Not Configured\".\n | extend AvZones = iff(tostring(AvZones) == \"0\", \"Not Configured\", tostring(AvZones)), AvSets = \"Scale Sets\"\n) on id\n// Start - Azure Load Balancer additional logic\n| mv-expand LbFeIpConfig = properties.frontendIPConfigurations\n| extend LbUseAvZone = iff(array_length(LbFeIpConfig.zones ) \u003e 0, array_length(LbFeIpConfig.zones ), 0)\n| extend LbIpType = iff(isnotnull(LbFeIpConfig.properties.publicIPAddress), \"Public\", \"Private\")\n//| summarize LbAvZones = min(LbUseAvZone) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), plan, tostring(properties)\n//| extend properties = todynamic(properties), sku = todynamic(sku), \n| summarize LbAvZones = arg_min(LbUseAvZone, *) by id\n// End - Azure Load Balancer additional logic\n| extend state = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.extended.instanceView.powerState.displayStatus),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.instanceView.powerState),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(properties.provisioningState),\n type == 'microsoft.web/sites', tostring(properties.state),\n type == 'microsoft.web/serverfarms', tostring(properties.status),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.provisioningState),\n type == 'microsoft.sql/servers/databases', tostring(properties.status),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.provisioningState),\n type == 'microsoft.dbformysql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbformysql/flexibleservers', tostring(properties.state),\n type == 'microsoft.dbforpostgresql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(properties.state),\n type == 'microsoft.cache/redis', tostring(properties.provisioningState),\n type == \"microsoft.apimanagement/service\", tostring(properties.provisioningState),\n type contains \"storageaccounts\", tostring(properties.provisioningState),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.provisioningState),\n type == \"microsoft.network/frontdoors\", tostring(properties.resourceState),\n type == \"microsoft.cdn/profiles\", tostring(properties.resourceState),\n type == \"microsoft.network/applicationgateways\", tostring(properties.operationalState),\n type == \"microsoft.network/loadbalancers\", tostring(properties.provisioningState),\n type contains \"publicip\", tostring(properties.provisioningState),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.provisioningState),\n type == \"microsoft.recoveryservices/vaults\", tostring(properties.provisioningState),\n \"Undefined\"\n )\n| extend skuName = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.hardwareProfile.vmSize),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.hardwareProfile.size),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.name),\n type == 'microsoft.web/sites', tostring(properties.sku),\n type == 'microsoft.web/serverfarms', tostring(sku.tier),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.agentPoolProfiles[0].vmSize),\n type == 'microsoft.sql/servers/databases', tostring(sku.tier),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.databaseAccountOfferType),\n type == 'microsoft.dbformysql/servers', tostring(sku.tier),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.cache/redis', tostring(properties.sku.name),\n type == \"microsoft.apimanagement/service\", tostring(sku.name),\n type contains 'storageaccounts', tostring(replace('-', '_', tostring(iff(type =~ \"microsoft.storage/storageaccounts\", sku.name, properties.accountType)))),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.sku.name),\n type == \"microsoft.network/frontdoors\", \"classic_frontdoor\",\n type == \"microsoft.cdn/profiles\", tostring(sku.name),\n type == \"microsoft.network/applicationgateways\", tostring(properties.sku.name),\n type == \"microsoft.network/loadbalancers\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type contains \"publicip\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.name),\n type == \"microsoft.recoveryservices/vaults\", tostring(iif(isnotnull(sku.tier), sku.tier, sku.name)),\n \"Undefined\"\n )\n| extend avZones = case(\n // reffer to: https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support\n location !in~ ('brazilsouth', 'canadacentral', 'centralus', 'eastus', 'eastus2', 'southcentralus', 'usgovvirginia', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachines'), coalesce(tostring(zones[0]), 'Not Configured'),\n (type == 'microsoft.classiccompute/virtualmachines'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachinescalesets'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == 'microsoft.containerservice/managedclusters' and AvZones \u003c\u003e \"\"), AvZones,\n (type == 'microsoft.containerservice/managedclusters' and isempty(AvZones)), \"Not Configured\",\n (type == 'microsoft.web/sites'), \"ASP AZ config\",\n (type == 'microsoft.web/serverfarms'), iff(properties.zoneRedundant == 'true', 'Configured', 'Not Configured'),\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), case( //SQL AZ SKU \u0026 region availability filter\n sku.tier == 'Basic' or sku.tier == 'Standard' or sku.name == 'System', 'Not Applicable',\n // Outside of these regions, SQL DB is not available in AZ. Refer to: https://learn.microsoft.com/en-us/azure/azure-sql/database/high-availability-sla?view=azuresql\u0026tabs=azure-powershell#general-purpose-service-tier-zone-redundant-availability\n sku.tier == 'GeneralPurpose' and location !in~ ('brazilsouth', 'eastus', 'eastus2', 'southcentralus', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n properties.zoneRedundant == 'true', 'Configured',\n 'Not Configured'\n ),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts'), iif(properties.locations[0].isZoneRedundant == \"false\", 'Not Configured', 'Configured'), \n (type == 'microsoft.dbformysql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.dbforpostgresql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole contains \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.cache/redis'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == \"microsoft.apimanagement/service\"), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type contains 'storageaccounts'), case(split(skuName, '_', 1)[0] contains \"zrs\", \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/azurefirewalls\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/loadbalancers\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n LbIpType =~ \"Public\", \"Public IP AZ Config\",\n tostring(LbAvZones) =~ \"0\", \"Not Configured\",\n tostring(LbAvZones)\n ),\n (type contains \"publicip\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n coalesce(tostring(array_length(parse_json(zones))), 'Not Configured')\n ),\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Public IP AZ Config\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend avSets = case(\n type == 'microsoft.compute/virtualmachines' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachines', (coalesce(extract('/availabilitySets/(.*)', 1, tostring(properties.availabilitySet.id)), 'Not Configured')),\n type == 'microsoft.classiccompute/virtualmachines', iff(isnotnull(properties.hardwareProfile.availabilitySet), 'Configured', 'Not Configured'),\n type == 'microsoft.compute/virtualmachinescalesets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', 'A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.',\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', case(\n AvSets == 'Scale Sets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n AvSets == 'Scale Sets', \"A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.\",\n \"Scale Sets Not Configured\"\n ),\n type == 'microsoft.sql/servers/databases', 'Not Applicable',\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', \"Not Applicable\",\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", tostring(properties.publicIPAddressVersion), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.gatewayType), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend Capacity = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.capacity),\n type == 'microsoft.web/sites', \"ASP Config\",\n type == 'microsoft.web/serverfarms', tostring(sku.capacity),\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(AksMinimumNodePoolCount), tostring(AksMinimumNodePoolCount), \"0\"), // AKS with or without VMSS\n type == 'microsoft.sql/servers/databases', tostring(sku.capacity),\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', tostring(sku.capacity),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.cache/redis', strcat(properties.sku.family, properties.sku.capacity),\n type == \"microsoft.apimanagement/service\", tostring(sku.capacity),\n type contains \"storageaccounts\", \"Not Applicable\", \n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", tostring(iif(isnotempty(properties.autoscaleConfiguration), properties.autoscaleConfiguration.minCapacity, properties.sku.capacity)),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", iif(type == \"microsoft.network/publicipprefixes\", \"PIP-prefix\", \"Single\"), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.capacity),\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend FaultDomain = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', iif(isnotempty(properties.platformFaultDomainCount), properties.platformFaultDomainCount, \"0\"), // 1 - AZ, 5 - Regional VMSS\n type == 'microsoft.web/sites', \"Not Applicable\",\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(tostring(FaultDomainCount)), tostring(FaultDomainCount), \"0\"),\n type == 'microsoft.sql/servers/databases', \"Not Applicable\",\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\" and properties.vpnType == \"PolicyBased\", \"ErPolicyBased\", tostring(properties.vpnType)), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend osDisk = case(\n type == 'microsoft.compute/virtualmachines', iif(properties.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.classiccompute/virtualmachines', 'Classic',\n type == 'microsoft.compute/virtualmachinescalesets', iif(properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', AksNodePoolStorageAccountType,\n type == 'microsoft.sql/servers/databases', properties.currentBackupStorageRedundancy,\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.platformVersion), //Field Override\n type contains \"storageaccounts\", tostring(split(skuName, '_', 0)[0]),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", tostring(LbIpType), //Field Override\n type contains \"publicip\", tostring(properties.publicIPAllocationMethod), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.vpnGatewayGeneration), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n 'Not Applicable'\n )\n| extend OSDisk = case(\n isnotempty(osDisk), osDisk,\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and state \u003c\u003e 'VM running', 'Unknown, start VM to get disk information.',\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and isnotempty(properties.storageProfile.osDisk.vhd.uri), 'Unmanaged',\n \"Unknown\")\n| extend ReadReplica = case (\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), tostring(properties.readReplicaCount), // SQL DB\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\", // Synapse\n type == 'microsoft.documentdb/databaseaccounts', tostring(array_length(parse_json(properties.readLocations))),\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.additionalLocations),\n type contains \"storageaccounts\", case(\n // Use the following query to get 3+0 regions: az account list-locations -o table --query '[?availabilityZoneMappings \u0026\u0026 (!metadata.pairedRegion || length(metadata.pairedRegion) == `0`)]'\n location in~ ('qatarcentral', 'polandcentral', 'israelcentral', 'italynorth') and split(skuName, '_', 1)[0] startswith \"zrs\" , 'Configured',\n split(skuName, '_', 1)[0] startswith \"ra\", \"Configured\",\n \"Not Configured\"\n ),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\", \"Not Applicable\", tostring(properties.activeActive)), //Field Override,\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend AutomaticFailover = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"false\" and properties.enableMultipleWriteLocations == \"false\" and toint(ReadReplica) \u003e 1), \"Not Configured\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"true\"), \"Configured\",\n (type == 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', case(\n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole != \"Replica\" , \"Not Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', case( \n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Not Configured\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbformysql/flexibleservers', case(properties.haEnabled == \"Enabled\", \"Configured\", \"Not Applicable\"),\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", iif(isnotempty(properties.autoscaleConfiguration), \"Configured\", \"Not Configured\"),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", \"Not Applicable\",\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend MultipleWriteLocations = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.dbformysql/servers', 'microsoft.dbformysql/flexibleservers', 'microsoft.dbforpostgresql/servers', 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"false\"), \"Not Enabled\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"true\"), \"Enabled\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend StorageAutogrow = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbformysql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend ReplicationRole = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), iif(isnotempty(properties.secondaryType), \"replica\", \"master\"),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbformysql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), tostring(split(skuName, '_', 1)[0]),\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| project \n Type = tolower(type),\n SkuName = tolower(skuName),\n Kind = tolower(kind),\n SubscriptionId = subscriptionId,\n Name = tolower(tostring(id)),\n State = tolower(state),\n Location = tolower(location),\n ResourceGroup = resourceGroup,\n Zones = tolower(tostring(zones)),\n AvailabilityZone = tolower(avZones),\n AvailabilitySet = tolower(avSets),\n Capacity = tolower(Capacity),\n FaultDomain = tolower(FaultDomain),\n OSDisk = tolower(OSDisk),\n ReadReplica = tolower(ReadReplica), \n AutomaticFailover = tolower(AutomaticFailover),\n MultipleWriteLocations = tolower(MultipleWriteLocations),\n StorageAutogrow = tolower(StorageAutogrow),\n ReplicationRole = tolower(ReplicationRole),\n Environment = environment,\n properties\n| join kind = leftouter (\n recoveryservicesresources\n | extend vmId = case(\n properties.backupManagementType == \"AzureIaasVM\", tolower(tostring(properties.dataSourceInfo.resourceID)),\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(properties.providerSpecificDetails.dataSourceInfo.resourceId)),\n ''\n )\n | extend asrId = iff(type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(strcat_array(array_slice(split(properties.recoveryFabricId, '/'), 0, 8), '/'))), '')\n | extend resourceId = case(\n properties.backupManagementType == \"AzureIaasVM\", vmId,\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", asrId,\n ''\n )\n | extend Backup = tostring(properties.protectionStatus)\n | extend replicationHealth = properties.replicationHealth\n | extend failoverHealth = properties.failoverHealth\n | extend protectionStateDescription = properties.protectionStateDescription\n | extend isReplicationAgentUpdateRequired = properties.providerSpecificDetails.isReplicationAgentUpdateRequired\n | project resourceId, vmId, asrId, Backup, replicationHealth, failoverHealth, protectionStateDescription, isReplicationAgentUpdateRequired\n )\n on $left.Name == $right.resourceId\n| extend Backup = case(\n Backup == \"Healthy\" or Backup == \"Unhealthy\", Backup,\n \"Unknown\")\n| extend Backup = case(\n (Type == 'microsoft.compute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == 'microsoft.classiccompute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == \"microsoft.compute/virtualmachinescalesets\"), \"Not Applicable\", \n (Type == \"microsoft.containerservice/managedclusters\"), \"Not Applicable\",\n (Type == 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (Type == 'microsoft.documentdb/databaseaccounts'), iif(properties.backupPolicy.type!=\"Continuous\",iif(properties.backupPolicy.periodicModeProperties.backupStorageRedundancy == \"Geo\", \"Geo\", \"Not Geo\"),\"Continuous\"),\n (Type == 'microsoft.dbformysql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbformysql/flexibleservers'), properties.backup.geoRedundantBackup,\n (Type == 'microsoft.dbforpostgresql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbforpostgresql/flexibleservers'), case(\n properties.backup.geoRedundantBackup == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Disabled\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.backup.geoRedundantBackup\n ),\n (Type contains \"storageaccounts\"), \"Not Applicable\",\n (Type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (Type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Unknown\"\n )\n| extend AvailabilitySet = case(\n AvailabilitySet == '-', 'None',\n isnotempty(AvailabilitySet), AvailabilitySet,\n \"Unknown\")\n\n| project Type, SkuName, Kind, SubscriptionId, Name, State, Location, ResourceGroup, Zones, AvailabilityZone, AvailabilitySet, Capacity, FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), orchestrationMode = properties.orchestrationMode, Environment\n| where Type == 'microsoft.compute/virtualmachinescalesets'\n",
"size": 3,
"title": "Virtual Machine Scale Sets",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "$gen_group",
"formatter": 13,
"formatOptions": {
"linkTarget": "Resource",
"showIcon": true
}
},
{
"columnMatch": "Type",
"formatter": 5
},
{
"columnMatch": "Name",
"formatter": 5
},
{
"columnMatch": "SubscriptionId",
"formatter": 5
},
{
"columnMatch": "State",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "succeeded",
"representation": "green",
"text": "{0}{1}"
},
{
"operator": "!=",
"thresholdValue": "succeeded",
"representation": "gray",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "Zones",
"formatter": 5
},
{
"columnMatch": "AvailabilityZone",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "not configured",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "undefined",
"representation": "unknown",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "1",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "2",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "3",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "not applicable",
"representation": "more",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "configured",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},