Repository navigation
Expand file tree
/
Copy pathReliabilityWorkbookWeb.workbook
More file actions
1389 lines (1388 loc) · 278 KB
/
Copy pathReliabilityWorkbookWeb.workbook
File metadata and controls
1389 lines (1388 loc) · 278 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",
"multiSelect": true,
"quote": "'",
"delimiter": ",",
"type": 2,
"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": 11,
"content": {
"version": "LinkItem/1.0",
"style": "tabs",
"links": [
{
"id": "111d0db9-8c81-413d-9d93-bca6541aa953",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "App Service Plan",
"subTarget": "ASP",
"style": "link"
},
{
"id": "9b2af52f-ffd5-43d7-9055-9a76f56ca89a",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "App Service",
"subTarget": "AS",
"style": "link"
},
{
"id": "e59db88a-717c-4985-bcd6-fad4defbda76",
"cellValue": "selectedTab",
"linkTarget": "parameter",
"linkLabel": "Function App",
"subTarget": "FA",
"style": "link"
}
]
},
"name": "links - 5"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 1,
"content": {
"json": "SLA for App Service Plan\r\n* There is no specific SLA tied to App service plan itself. The SLAs are applicable for the services running on the App Service plans.\r\n\r\n> SLA accurate at time of release. Latest information is available [here](https://azure.microsoft.com/support/legal/sla/app-service/)",
"style": "upsell"
},
"conditionalVisibility": {
"parameterName": "SLA",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "asp-sla"
},
{
"type": 1,
"content": {
"json": "* Use isolated or Premium tier. These tiers support staging slots and automated backups.\r\n* Avoid scaling up or down. Instead, select a tier and instance size that meet your performance requirements under typical load, and then scale out the instances to handle changes in traffic volume. Scaling up and down may trigger an application restart.\r\n* Store configuration as app settings. Use app settings to hold configuration settings as app settings. Define the settings in your Resource Manager templates, or using PowerShell, so that you can apply them as part of an automated deployment / update process, which is more reliable.\r\n* Create separate App Service plans for production and test. Don't use slots on your production deployment for testing. All apps within the same App Service plan share the same VM instances. If you put production and test deployments in the same plan, it can negatively affect the production deployment. For example, load tests might degrade the live production site. By putting test deployments into a separate plan, you isolate them from the production version.\r\n* Separate web apps from web APIs. If your solution has both a web front end and a web API, consider decomposing them into separate App Service apps. This design makes it easier to decompose the solution by workload. You can run the web app and the API in separate App Service plans, so they can be scaled independently. If you don't need that level of scalability at first, you can deploy the apps into the same plan, and move them into separate plans later, if needed.\r\n* Create auto scaling configuration as part of App service plan.\r\n* Deploy App Service Plan in [availability zones](https://learn.microsoft.com/azure/reliability/migrate-app-service)\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": "asp-help"
},
{
"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.web/serverfarms'\n| summarize ResourceTotal=count(Name), NotRunning=dcountif(Name, State !in~ (\"ready\")), NotRecommendedSKU=dcountif(Name, SkuName in~ (\"free\", \"shared\", \"basic\", \"dynamic\")), NoAVZone=dcountif(Name, AvailabilityZone == \"not configured\"), CapacityLt2=dcountif(Name, toint(Capacity) \u003c 2)\n",
"size": 3,
"title": "App Service Plan - Recommendation Summary",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "ResourceTotal",
"formatter": 22,
"formatOptions": {
"compositeBarSettings": {
"labelText": "",
"columnSettings": [
{
"columnName": "NotRunning",
"color": "lightBlue"
},
{
"columnName": "NotRecommendedSKU",
"color": "orange"
},
{
"columnName": "NoAVZone",
"color": "purple"
},
{
"columnName": "CapacityLt2",
"color": "red"
}
]
}
}
},
{
"columnMatch": "Group",
"formatter": 1
}
],
"rowLimit": 10000,
"labelSettings": [
{
"columnId": "ResourceTotal",
"label": "Resource Total"
},
{
"columnId": "NotRunning",
"label": "Failed Status"
},
{
"columnId": "NotRecommendedSKU",
"label": "Non-production SKU"
},
{
"columnId": "NoAVZone",
"label": "No Availability Zone"
},
{
"columnId": "CapacityLt2",
"label": "Capacity less than 2"
}
]
}
},
"name": "kql_webapp_appsvcplan_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, toint(Capacity), FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), numberOfSite=properties.numberOfSites, Environment\n| where Type == 'microsoft.web/serverfarms'\n",
"size": 3,
"title": "App Service Plan",
"noDataMessage": "No App Service plans 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": "SkuName",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "isolated",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "premium",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "workflowstandard",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "standard",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "regex",
"thresholdValue": "^(free|shared|basic|dynamic)$",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "SubscriptionId",
"formatter": 5
},
{
"columnMatch": "Name",
"formatter": 5
},
{
"columnMatch": "State",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "ready",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "!=",
"thresholdValue": "ready",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "Location",
"formatter": 17
},
{
"columnMatch": "Zones",
"formatter": 5
},
{
"columnMatch": "AvailabilityZone",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "configured",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "not configured",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "not applicable",
"representation": "more",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "AvailabilitySet",
"formatter": 5
},
{
"columnMatch": "Capacity",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "<=",
"thresholdValue": "1",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "success",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "FaultDomain",
"formatter": 5
},
{
"columnMatch": "OSDisk",
"formatter": 5
},
{
"columnMatch": "ReadReplica",
"formatter": 5
},
{
"columnMatch": "AutomaticFailover",
"formatter": 5
},
{
"columnMatch": "MultipleWriteLocations",
"formatter": 5
},
{
"columnMatch": "StorageAutogrow",
"formatter": 5
},
{
"columnMatch": "ReplicationRole",
"formatter": 5
},
{
"columnMatch": "Backup",
"formatter": 5
},
{
"columnMatch": "numberOfSite",
"formatter": 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}"
}
]
}
}
],
"rowLimit": 10000,
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"SubscriptionId"
],
"finalBy": "Name"
},
"labelSettings": [
{
"columnId": "SkuName",
"label": "SKU"
},
{
"columnId": "SubscriptionId",
"label": "Subscription"
},
{
"columnId": "ResourceGroup",
"label": "Resource Group"
},
{
"columnId": "AvailabilityZone",
"label": "Availability Zone"
},
{
"columnId": "Capacity",
"label": "Number of Instances"
},
{
"columnId": "numberOfSite",
"label": "Number of Sites"
}
]
}
},
"name": "kql_webapp_appsvcplan_resources_details"
}
]
},
"conditionalVisibility": {
"parameterName": "selectedTab",
"comparison": "isEqualTo",
"value": "ASP"
},
"name": "App Service Plan"
},
{
"type": 12,
"content": {
"version": "NotebookGroup/1.0",
"groupType": "editable",
"items": [
{
"type": 1,
"content": {
"json": "[SLA for App Service](https://azure.microsoft.com/support/legal/sla/app-service/)\r\n* We guarantee that Apps running in a customer subscription will be available 99.95% of the time. \r\n* No SLA is provided for Apps under either the Free or Shared tiers.\r\n\r\n> SLA accurate at time of release. Latest information is available [here](https://azure.microsoft.com/support/legal/sla/app-service/)",
"style": "upsell"
},
"conditionalVisibility": {
"parameterName": "SLA",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 2 - Copy"
},
{
"type": 1,
"content": {
"json": "> * Use Standard or Premium tier. These tiers support staging slots and automated backups.\r\n* Avoid scaling up or down. Instead, select a tier and instance size that meet your performance requirements under typical load, and then scale out the instances to handle changes in traffic volume. Scaling up and down may trigger an application restart.\r\n* Store configuration as app settings. Use app settings to hold configuration settings as app settings. Define the settings in your Resource Manager templates, or using PowerShell, so that you can apply them as part of an automated deployment / update process, which is more reliable.\r\n* Create separate App Service plans for production and test. Don't use slots on your production deployment for testing. All apps within the same App Service plan share the same VM instances. If you put production and test deployments in the same plan, it can negatively affect the production deployment. For example, load tests might degrade the live production site. By putting test deployments into a separate plan, you isolate them from the production version.\r\n* Separate web apps from web APIs. If your solution has both a web front end and a web API, consider decomposing them into separate App Service apps. This design makes it easier to decompose the solution by workload. You can run the web app and the API in separate App Service plans, so they can be scaled independently. If you don't need that level of scalability at first, you can deploy the apps into the same plan, and move them into separate plans later, if needed.\r\n* Avoid using the App Service backup feature to back up Azure SQL databases. Instead, use SQL Database automated backups. App Service backup exports the database to a SQL BACPAC file, which costs DTUs.\r\n* Deploy to a staging slot. Create a deployment slot for staging. Deploy application updates to the staging slot, and verify the deployment before swapping it into production. This reduces the chance of a bad update in production. It also ensures that all instances are warmed up before being swapped into production. Many applications have a significant warmup and cold-start time.\r\n* Create a deployment slot to hold the last-known-good (LKG) deployment. When you deploy an update to production, move the previous production deployment into the LKG slot. This makes it easier to roll back a bad deployment. If you discover a problem later, you can quickly revert to the LKG version.\r\n* Enable diagnostics logging, including application logging and web server logging. Logging is important for monitoring and diagnostics.\r\n* Log to blob storage. This makes it easier to collect and analyze the data.\r\n* Create a separate storage account for logs. Don't use the same storage account for logs and application data. This helps to prevent logging from reducing application performance.\r\n* Monitor performance. Use a performance monitoring service such as Application Insights to monitor application performance and behavior under load. Performance monitoring gives you real-time insight into the application. It enables you to diagnose issues and perform root-cause analysis of failures.",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "Help",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 3 - Copy"
},
{
"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, AlwaysOnEnabled=tolower(tostring(properties.siteConfig.alwaysOn)), AffinityEnabled=tolower(tostring(properties.clientAffinityEnabled)), Environment\n| where Type == 'microsoft.web/sites' and Kind !contains 'functionapp' and Kind !contains 'workflowapp'\n| summarize ResourceTotal=count(Name), NotRunning=dcountif(Name, State !in~ (\"running\")), AlwaysOnDisabled=dcountif(Name, AlwaysOnEnabled==\"false\"), AffinityEnabled=dcountif(Name, AffinityEnabled==\"true\")\n",
"size": 3,
"title": "App Service - Web App - Recommendation Summary",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "ResourceTotal",
"formatter": 22,
"formatOptions": {
"compositeBarSettings": {
"labelText": "",
"columnSettings": [
{
"columnName": "NotRunning",
"color": "lightBlue"
},
{
"columnName": "AlwaysOnDisabled",
"color": "orange"
},
{
"columnName": "AffinityEnabled",
"color": "purple"
}
]
}
}
}
],
"rowLimit": 10000,
"labelSettings": [
{
"columnId": "ResourceTotal",
"label": "Resource Total"
},
{
"columnId": "NotRunning",
"label": "Failed Status"
},
{
"columnId": "AlwaysOnDisabled",
"label": "AlwaysOn Disabled"
},
{
"columnId": "AffinityEnabled",
"label": "Affinity Enabled"
}
]
}
},
"name": "kql_webapp_appsvc_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, AlwaysOnEnabled=tolower(tostring(properties.siteConfig.alwaysOn)), AffinityEnabled=tolower(tostring(properties.clientAffinityEnabled)), Environment\n| where Type == 'microsoft.web/sites' and Kind !contains 'functionapp' and Kind !contains 'workflowapp'\n",
"size": 3,
"title": "App Service - Web App",
"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": "SkuName",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "shared",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "free",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "basic",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "develop",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "standard",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "premium",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "unknown",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "SubscriptionId",
"formatter": 5
},
{
"columnMatch": "Name",
"formatter": 5
},
{
"columnMatch": "State",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "running",
"representation": "green",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "stopped",
"representation": "orange",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "Location",
"formatter": 17
},
{
"columnMatch": "Zones",
"formatter": 5
},
{
"columnMatch": "AvailabilitySet",
"formatter": 5
},
{
"columnMatch": "Capacity",
"formatter": 5
},
{
"columnMatch": "FaultDomain",
"formatter": 5
},
{
"columnMatch": "OSDisk",
"formatter": 5
},
{
"columnMatch": "ReadReplica",
"formatter": 5
},
{
"columnMatch": "AutomaticFailover",
"formatter": 5
},
{
"columnMatch": "MultipleWriteLocations",
"formatter": 5
},
{
"columnMatch": "StorageAutogrow",
"formatter": 5
},
{
"columnMatch": "ReplicationRole",
"formatter": 5
},
{
"columnMatch": "Backup",
"formatter": 5
},
{
"columnMatch": "AlwaysOnEnabled",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "false",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "success",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "AffinityEnabled",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "true",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "success",
"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": "Status",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "Running",
"representation": "green",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "Stopped",
"representation": "gray",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "Tier",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "Free",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "Shared",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "success",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "AppType",
"formatter": 5
}
],
"rowLimit": 10000,
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"SubscriptionId"
],
"expandTopLevel": false,
"finalBy": "Name"
},
"labelSettings": [
{
"columnId": "SubscriptionId",
"label": "Subscription"
},
{
"columnId": "ResourceGroup",
"label": "Resource Group"
}
]
}
},
"name": "kql_webapp_appsvc_resources_details"
}
]
},
"conditionalVisibility": {
"parameterName": "selectedTab",
"comparison": "isEqualTo",
"value": "AS"
},
"name": "App Service"
},
{
"type": 12,
"content": {