Repository navigation
Expand file tree
/
Copy pathReliabilityWorkbookStorage.workbook
More file actions
801 lines (801 loc) · 140 KB
/
Copy pathReliabilityWorkbookStorage.workbook
File metadata and controls
801 lines (801 loc) · 140 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
{
"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": 1,
"content": {
"json": "[SLA for Storage Accounts](https://azure.microsoft.com/support/legal/sla/storage/)\r\n* We guarantee that at least 99.99% (99.9% for Cool Access Tier) of the time, we will successfully process requests to read data from Read Access-Geo Redundant Storage (RA-GRS) Accounts, provided that failed attempts to read data from the primary region are retried on the secondary region.\r\n* We guarantee that at least 99.9% (99% for Cool Access Tier) of the time, we will successfully process requests to read data from Locally Redundant Storage (LRS), Zone Redundant Storage (ZRS), and Geo Redundant Storage (GRS) Accounts.\r\n* We guarantee that at least 99.9% (99% for Cool Access Tier) of the time, we will successfully process requests to write data to Locally Redundant Storage (LRS), Zone Redundant Storage (ZRS), and Geo Redundant Storage (GRS) Accounts and Read Access-Geo Redundant Storage (RA-GRS) Accounts.\r\n\r\n> SLA accurate at time of release. Latest information is available [here](https://azure.microsoft.com/support/legal/sla/storage/)",
"style": "upsell"
},
"conditionalVisibility": {
"parameterName": "SLA",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 2 - Copy - Copy"
},
{
"type": 1,
"content": {
"json": "> * For application data, use read-access geo-redundant storage (RA-GRS). RA-GRS storage replicates the data to a secondary region, and provides read-only access from the secondary region. If there is a storage outage in the primary region, the application can read the data from the secondary region.\r\n* For VM disks, use managed disks. Managed disks provide better reliability for VMs in an availability set, because the disks are sufficiently isolated from each other to avoid single points of failure. Also, managed disks aren't subject to the IOPS limits of VHDs created in a storage account.\r\n* For Queue storage, create a backup queue in another region. For Queue storage, a read-only replica has limited use, because you can't queue or dequeue items. Instead, create a backup queue in a storage account in another region. If there is a storage outage, the application can use the backup queue, until the primary region becomes available again. That way, the application can still process new requests\r\n* In regions with availability zones but without a regional pair, Azure achieves high availability using availability zones along with locally redundant or zone-redundant storage (LRS/ZRS). These regions, lacking geo-redundant storage (GRS), adhere to data residency guidelines to keep data within the same region. If you'd like more information, please refer to [this documentation](https://learn.microsoft.com/en-us/azure/reliability/cross-region-replication-azure#regions-with-availability-zones-and-no-region-pair).",
"style": "info"
},
"conditionalVisibility": {
"parameterName": "Help",
"comparison": "isEqualTo",
"value": "Yes"
},
"name": "text - 3 - Copy - 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, AvailabilitySet, Capacity, FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), Environment\n| where Type =~ \"microsoft.storage/storageaccounts\" or Type =~ \"microsoft.classicstorage/storageaccounts\"\n| summarize ResourceTotal=count(Name), Storagev1=dcountif(Name, Kind == \"storage\" or Kind == \"blobstorage\"), NoReplica=dcountif(Name, ReadReplica == \"not configured\"), Classic=dcountif(Name, Type =~ \"microsoft.classicstorage/storageaccounts\")\n",
"size": 3,
"title": "Storage Account - Recommendations Summary",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "ResourceTotal",
"formatter": 22,
"formatOptions": {
"compositeBarSettings": {
"labelText": "",
"columnSettings": [
{
"columnName": "Storagev1",
"color": "orange"
},
{
"columnName": "NoReplica",
"color": "blue"
},
{
"columnName": "Classic",
"color": "redBright"
}
]
}
}
}
],
"rowLimit": 10000,
"labelSettings": [
{
"columnId": "ResourceTotal",
"label": "Resource Total"
},
{
"columnId": "Storagev1",
"label": "Storage V1"
},
{
"columnId": "NoReplica",
"label": "Replication Not Enabled"
},
{
"columnId": "Classic",
"label": "Classic"
}
]
}
},
"name": "kql_storage_account_resources_details_summary"
},
{
"type": 3,
"content": {
"version": "KqlItem/1.0",
"query": "resources\n| where resourceGroup in ({ResourceGroup})\n| extend environment = case(\n tags.Environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Environment)),\n tags.environment \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.environment)),\n tags.Env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.Env)),\n tags.env \u003c\u003e \"\", replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags.env)),\n tolower(name) contains \"prod\", \"Production\",\n tolower(name) contains \"dev\", \"Development\",\n tolower(name) contains \"qa\", \"QA\",\n tolower(name) contains \"uat\", \"UAT\",\n tolower(name) contains \"sit\", \"SIT\",\n tolower(name) contains \"test\", \"Test\",\n \"Undefined\")\n| where environment in ({Environment})\n| join kind = inner(\n resources\n | extend tagName = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(bag_keys(tags)[0]))\n | extend tagValue = replace(\"\\\\\\\\\", \"\u003cBackslash\u003e\", tostring(tags[tagName]))\n | distinct tagName,tagValue,id\n | where (('*' in (dynamic([{TagName}])) or tagName in (dynamic([{TagName}])))) and (('*' in (dynamic([{TagValue}])) or tagValue in (dynamic([{TagValue}]))))\n | distinct id\n)\non id\n| where \n (type == 'microsoft.compute/virtualmachines') or \n (type == 'microsoft.classiccompute/virtualmachines') or \n (type == \"microsoft.compute/virtualmachinescalesets\" and tags.aksEngineVersion !contains \"aks-gomod\") or\n (type == 'microsoft.web/sites') or \n (type == 'microsoft.web/serverfarms') or\n (type == \"microsoft.containerservice/managedclusters\") or \n (type == 'microsoft.sql/servers/databases') or \n (type == 'microsoft.documentdb/databaseaccounts') or \n (type == 'microsoft.dbformysql/servers') or \n (type == 'microsoft.dbformysql/flexibleservers') or\n (type == 'microsoft.dbforpostgresql/servers') or \n (type == 'microsoft.dbforpostgresql/flexibleservers') or \n (type == 'microsoft.cache/redis') or\n (type == \"microsoft.apimanagement/service\") or \n (type == \"microsoft.storage/storageaccounts\" or type == \"microsoft.classicstorage/storageaccounts\") or \n (type == \"microsoft.network/azurefirewalls\") or \n (type == \"microsoft.network/frontdoors\") or\n (type == \"microsoft.cdn/profiles\") or\n (type == \"microsoft.network/applicationgateways\") or \n (type == \"microsoft.network/loadbalancers\") or \n (type == \"microsoft.network/publicipaddresses\" or type == \"microsoft.network/publicipprefixes\") or \n (type == \"microsoft.network/virtualnetworkgateways\") or \n (type == \"microsoft.recoveryservices/vaults\")\n| join kind=leftouter (\n resources \n | where type == \"microsoft.containerservice/managedclusters\"\n // Expand per node pool to get using zone for all node pool\n | mv-expand agentPoolProfiles = properties.agentPoolProfiles\n | extend AvZones = agentPoolProfiles.availabilityZones\n | extend AksNodeResourceGroup = tolower(tostring(properties.nodeResourceGroup))\n // Get number of using zone per node pool VMSS. If it doesn't use any zone, return 0\n | extend useAvZone = case(\n array_length( AvZones ) \u003e 0, array_length( AvZones ), 0\n )\n | join kind=leftouter(\n resources\n | where type == 'microsoft.compute/virtualmachinescalesets'\n | extend resourceGroup = tolower(tostring(resourceGroup))\n | extend VmssCapacity = sku.capacity\n | extend vmssStorageAccountType = iff(\n properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType\n )\n ) on $left.AksNodeResourceGroup == $right.resourceGroup // Match AKS and VMSS with nodeResourceGroup\n | summarize AvZones=min(useAvZone), AksMinimumNodePoolCount=min(toint(VmssCapacity)), AksNodePoolStorageAccountType=make_set(vmssStorageAccountType), FaultDomainCount=min(toint(properties1.platformFaultDomainCount)) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), tostring(plan), tostring(properties), AksNodeResourceGroup\n | extend AksNodePoolStorageAccountType = iff(\n tolower(tostring(AksNodePoolStorageAccountType)) contains \"standard_lrs\", \"standard_lrs\", tolower(tostring(strcat_array(AksNodePoolStorageAccountType, \",\")))\n )\n // If there are some node pools within AKS cluster, it returns minimum number of zones. \n // If even one node pool is not using a zone, it will be \"Not Configured\".\n | extend AvZones = iff(tostring(AvZones) == \"0\", \"Not Configured\", tostring(AvZones)), AvSets = \"Scale Sets\"\n) on id\n// Start - Azure Load Balancer additional logic\n| mv-expand LbFeIpConfig = properties.frontendIPConfigurations\n| extend LbUseAvZone = iff(array_length(LbFeIpConfig.zones ) \u003e 0, array_length(LbFeIpConfig.zones ), 0)\n| extend LbIpType = iff(isnotnull(LbFeIpConfig.properties.publicIPAddress), \"Public\", \"Private\")\n//| summarize LbAvZones = min(LbUseAvZone) by id, name, type, tenantId, kind, location, resourceGroup, subscriptionId, tostring(sku), plan, tostring(properties)\n//| extend properties = todynamic(properties), sku = todynamic(sku), \n| summarize LbAvZones = arg_min(LbUseAvZone, *) by id\n// End - Azure Load Balancer additional logic\n| extend state = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.extended.instanceView.powerState.displayStatus),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.instanceView.powerState),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(properties.provisioningState),\n type == 'microsoft.web/sites', tostring(properties.state),\n type == 'microsoft.web/serverfarms', tostring(properties.status),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.provisioningState),\n type == 'microsoft.sql/servers/databases', tostring(properties.status),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.provisioningState),\n type == 'microsoft.dbformysql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbformysql/flexibleservers', tostring(properties.state),\n type == 'microsoft.dbforpostgresql/servers', tostring(properties.userVisibleState),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(properties.state),\n type == 'microsoft.cache/redis', tostring(properties.provisioningState),\n type == \"microsoft.apimanagement/service\", tostring(properties.provisioningState),\n type contains \"storageaccounts\", tostring(properties.provisioningState),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.provisioningState),\n type == \"microsoft.network/frontdoors\", tostring(properties.resourceState),\n type == \"microsoft.cdn/profiles\", tostring(properties.resourceState),\n type == \"microsoft.network/applicationgateways\", tostring(properties.operationalState),\n type == \"microsoft.network/loadbalancers\", tostring(properties.provisioningState),\n type contains \"publicip\", tostring(properties.provisioningState),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.provisioningState),\n type == \"microsoft.recoveryservices/vaults\", tostring(properties.provisioningState),\n \"Undefined\"\n )\n| extend skuName = case(\n type == 'microsoft.compute/virtualmachines', tostring(properties.hardwareProfile.vmSize),\n type == 'microsoft.classiccompute/virtualmachines', tostring(properties.hardwareProfile.size),\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.name),\n type == 'microsoft.web/sites', tostring(properties.sku),\n type == 'microsoft.web/serverfarms', tostring(sku.tier),\n type == 'microsoft.containerservice/managedclusters', tostring(properties.agentPoolProfiles[0].vmSize),\n type == 'microsoft.sql/servers/databases', tostring(sku.tier),\n type == 'microsoft.documentdb/databaseaccounts', tostring(properties.databaseAccountOfferType),\n type == 'microsoft.dbformysql/servers', tostring(sku.tier),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.tier),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.tier),\n type == 'microsoft.cache/redis', tostring(properties.sku.name),\n type == \"microsoft.apimanagement/service\", tostring(sku.name),\n type contains 'storageaccounts', tostring(replace('-', '_', tostring(iff(type =~ \"microsoft.storage/storageaccounts\", sku.name, properties.accountType)))),\n type == \"microsoft.network/azurefirewalls\", tostring(properties.sku.name),\n type == \"microsoft.network/frontdoors\", \"classic_frontdoor\",\n type == \"microsoft.cdn/profiles\", tostring(sku.name),\n type == \"microsoft.network/applicationgateways\", tostring(properties.sku.name),\n type == \"microsoft.network/loadbalancers\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type contains \"publicip\", iff(sku.tier == 'Global', 'Global', tostring(sku.name)),\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.name),\n type == \"microsoft.recoveryservices/vaults\", tostring(iif(isnotnull(sku.tier), sku.tier, sku.name)),\n \"Undefined\"\n )\n| extend avZones = case(\n // reffer to: https://learn.microsoft.com/en-us/azure/reliability/availability-zones-service-support#azure-regions-with-availability-zone-support\n location !in~ ('brazilsouth', 'canadacentral', 'centralus', 'eastus', 'eastus2', 'southcentralus', 'usgovvirginia', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachines'), coalesce(tostring(zones[0]), 'Not Configured'),\n (type == 'microsoft.classiccompute/virtualmachines'), 'Not Applicable',\n (type == 'microsoft.compute/virtualmachinescalesets'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == 'microsoft.containerservice/managedclusters' and AvZones \u003c\u003e \"\"), AvZones,\n (type == 'microsoft.containerservice/managedclusters' and isempty(AvZones)), \"Not Configured\",\n (type == 'microsoft.web/sites'), \"ASP AZ config\",\n (type == 'microsoft.web/serverfarms'), iff(properties.zoneRedundant == 'true', 'Configured', 'Not Configured'),\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), case( //SQL AZ SKU \u0026 region availability filter\n sku.tier == 'Basic' or sku.tier == 'Standard' or sku.name == 'System', 'Not Applicable',\n // Outside of these regions, SQL DB is not available in AZ. Refer to: https://learn.microsoft.com/en-us/azure/azure-sql/database/high-availability-sla?view=azuresql\u0026tabs=azure-powershell#general-purpose-service-tier-zone-redundant-availability\n sku.tier == 'GeneralPurpose' and location !in~ ('brazilsouth', 'eastus', 'eastus2', 'southcentralus', 'westus2', 'westus3', 'francecentral', 'germanywestcentral', 'northeurope', 'norwayeast', 'uksouth', 'westeurope', 'swedencentral', 'switzerlandnorth', 'polandcentral', 'qatarcentral', 'uaenorth', 'southafricanorth', 'australiaeast', 'centralindia', 'japaneast', 'koreacentral', 'southeastasia', 'eastasia', 'chinanorth3', 'italynorth', 'israelcentral'), 'Not Applicable',\n properties.zoneRedundant == 'true', 'Configured',\n 'Not Configured'\n ),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts'), iif(properties.locations[0].isZoneRedundant == \"false\", 'Not Configured', 'Configured'), \n (type == 'microsoft.dbformysql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.dbforpostgresql/servers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/flexibleservers'),case(\n properties.highAvailability.mode == \"ZoneRedundant\", \"Configured\",\n properties.replicationRole contains \"Replica\", \"Not Applicable\",\n 'Not Configured'\n ),\n (type == 'microsoft.cache/redis'), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type == \"microsoft.apimanagement/service\"), coalesce(tostring(array_length(parse_json(zones))), 'Not Configured'),\n (type contains 'storageaccounts'), case(split(skuName, '_', 1)[0] contains \"zrs\", \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/azurefirewalls\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), iif(isnotnull(zones), \"Configured\", \"Not Configured\"),\n (type == \"microsoft.network/loadbalancers\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n LbIpType =~ \"Public\", \"Public IP AZ Config\",\n tostring(LbAvZones) =~ \"0\", \"Not Configured\",\n tostring(LbAvZones)\n ),\n (type contains \"publicip\"), case( \n skuName =~ \"Basic\" or skuName =~ \"Global\", \"Not Applicable\",\n coalesce(tostring(array_length(parse_json(zones))), 'Not Configured')\n ),\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Public IP AZ Config\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend avSets = case(\n type == 'microsoft.compute/virtualmachines' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachines', (coalesce(extract('/availabilitySets/(.*)', 1, tostring(properties.availabilitySet.id)), 'Not Configured')),\n type == 'microsoft.classiccompute/virtualmachines', iff(isnotnull(properties.hardwareProfile.availabilitySet), 'Configured', 'Not Configured'),\n type == 'microsoft.compute/virtualmachinescalesets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', 'A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.',\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', case(\n AvSets == 'Scale Sets' and avZones in ('1', '2', '3'), \"Not Applicable\",\n AvSets == 'Scale Sets', \"A regional (non-zonal) scale set uses placement groups, which act as an implicit availability set with five fault domains and five update domains.\",\n \"Scale Sets Not Configured\"\n ),\n type == 'microsoft.sql/servers/databases', 'Not Applicable',\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', \"Not Applicable\",\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", tostring(properties.publicIPAddressVersion), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.gatewayType), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend Capacity = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', tostring(sku.capacity),\n type == 'microsoft.web/sites', \"ASP Config\",\n type == 'microsoft.web/serverfarms', tostring(sku.capacity),\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(AksMinimumNodePoolCount), tostring(AksMinimumNodePoolCount), \"0\"), // AKS with or without VMSS\n type == 'microsoft.sql/servers/databases', tostring(sku.capacity),\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', tostring(sku.capacity),\n type == 'microsoft.dbformysql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/servers', tostring(sku.capacity),\n type == 'microsoft.dbforpostgresql/flexibleservers', tostring(sku.capacity),\n type == 'microsoft.cache/redis', strcat(properties.sku.family, properties.sku.capacity),\n type == \"microsoft.apimanagement/service\", tostring(sku.capacity),\n type contains \"storageaccounts\", \"Not Applicable\", \n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", tostring(iif(isnotempty(properties.autoscaleConfiguration), properties.autoscaleConfiguration.minCapacity, properties.sku.capacity)),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", iif(type == \"microsoft.network/publicipprefixes\", \"PIP-prefix\", \"Single\"), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.sku.capacity),\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend FaultDomain = case(\n type == 'microsoft.compute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.classiccompute/virtualmachines', \"Not Applicable\",\n type == 'microsoft.compute/virtualmachinescalesets', iif(isnotempty(properties.platformFaultDomainCount), properties.platformFaultDomainCount, \"0\"), // 1 - AZ, 5 - Regional VMSS\n type == 'microsoft.web/sites', \"Not Applicable\",\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', iif(isnotempty(tostring(FaultDomainCount)), tostring(FaultDomainCount), \"0\"),\n type == 'microsoft.sql/servers/databases', \"Not Applicable\",\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\" and properties.vpnType == \"PolicyBased\", \"ErPolicyBased\", tostring(properties.vpnType)), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend osDisk = case(\n type == 'microsoft.compute/virtualmachines', iif(properties.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.classiccompute/virtualmachines', 'Classic',\n type == 'microsoft.compute/virtualmachinescalesets', iif(properties.virtualMachineProfile.storageProfile.osDisk.diffDiskSettings.option == \"Local\", \"Ephemeral\", properties.virtualMachineProfile.storageProfile.osDisk.managedDisk.storageAccountType),\n type == 'microsoft.web/sites', 'Not Applicable',\n type == 'microsoft.web/serverfarms', 'Not Applicable',\n type == 'microsoft.containerservice/managedclusters', AksNodePoolStorageAccountType,\n type == 'microsoft.sql/servers/databases', properties.currentBackupStorageRedundancy,\n type == 'microsoft.documentdb/databaseaccounts', 'Not Applicable',\n type == 'microsoft.dbformysql/servers', 'Not Applicable',\n type == 'microsoft.dbformysql/flexibleservers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/servers', 'Not Applicable',\n type == 'microsoft.dbforpostgresql/flexibleservers', 'Not Applicable',\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.platformVersion), //Field Override\n type contains \"storageaccounts\", tostring(split(skuName, '_', 0)[0]),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", tostring(LbIpType), //Field Override\n type contains \"publicip\", tostring(properties.publicIPAllocationMethod), //Field Override\n type == \"microsoft.network/virtualnetworkgateways\", tostring(properties.vpnGatewayGeneration), //Field Override\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n 'Not Applicable'\n )\n| extend OSDisk = case(\n isnotempty(osDisk), osDisk,\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and state \u003c\u003e 'VM running', 'Unknown, start VM to get disk information.',\n isempty(osDisk) and (type == 'microsoft.compute/virtualmachines') and isnotempty(properties.storageProfile.osDisk.vhd.uri), 'Unmanaged',\n \"Unknown\")\n| extend ReadReplica = case (\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), tostring(properties.readReplicaCount), // SQL DB\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\", // Synapse\n type == 'microsoft.documentdb/databaseaccounts', tostring(array_length(parse_json(properties.readLocations))),\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', \"Not Applicable\",\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", tostring(properties.additionalLocations),\n type contains \"storageaccounts\", case(\n // Use the following query to get 3+0 regions: az account list-locations -o table --query '[?availabilityZoneMappings \u0026\u0026 (!metadata.pairedRegion || length(metadata.pairedRegion) == `0`)]'\n location in~ ('qatarcentral', 'polandcentral', 'israelcentral', 'italynorth') and split(skuName, '_', 1)[0] startswith \"zrs\" , 'Configured',\n split(skuName, '_', 1)[0] startswith \"ra\", \"Configured\",\n \"Not Configured\"\n ),\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", \"Not Applicable\",\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", iff(properties.gatewayType == \"ExpressRoute\", \"Not Applicable\", tostring(properties.activeActive)), //Field Override,\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend AutomaticFailover = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"false\" and properties.enableMultipleWriteLocations == \"false\" and toint(ReadReplica) \u003e 1), \"Not Configured\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableAutomaticFailover == \"true\"), \"Configured\",\n (type == 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n type == 'microsoft.dbformysql/servers', \"Not Applicable\",\n type == 'microsoft.dbformysql/flexibleservers', case(\n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole != \"Replica\" , \"Not Configured\",\n properties.replicationRole == \"Replica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbforpostgresql/servers', \"Not Applicable\",\n type == 'microsoft.dbforpostgresql/flexibleservers', case( \n properties.highAvailability.mode == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Not Configured\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.highAvailability.mode == \"ZoneRedundant\", \"Zone Redundant\",\n properties.highAvailability.mode == \"SameZone\", \"Same Zone\",\n properties.highAvailability.mode\n ),\n type == 'microsoft.dbformysql/flexibleservers', case(properties.haEnabled == \"Enabled\", \"Configured\", \"Not Applicable\"),\n type == 'microsoft.cache/redis', 'Not Applicable',\n type == \"microsoft.apimanagement/service\", \"Not Applicable\",\n type contains \"storageaccounts\", \"Not Applicable\",\n type == \"microsoft.network/azurefirewalls\", \"Not Applicable\",\n type == \"microsoft.network/frontdoors\", \"Not Applicable\",\n type == \"microsoft.cdn/profiles\", \"Not Applicable\",\n type == \"microsoft.network/applicationgateways\", iif(isnotempty(properties.autoscaleConfiguration), \"Configured\", \"Not Configured\"),\n type == \"microsoft.network/loadbalancers\", \"Not Applicable\",\n type contains \"publicip\", \"Not Applicable\",\n type == \"microsoft.network/virtualnetworkgateways\", \"Not Applicable\",\n type == \"microsoft.recoveryservices/vaults\", \"Not Applicable\",\n \"Undefined\"\n )\n| extend MultipleWriteLocations = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.dbformysql/servers', 'microsoft.dbformysql/flexibleservers', 'microsoft.dbforpostgresql/servers', 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"false\"), \"Not Enabled\",\n (type == 'microsoft.documentdb/databaseaccounts' and properties.enableMultipleWriteLocations == \"true\"), \"Enabled\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend StorageAutogrow = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.sql/servers/databases', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbformysql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.storageProfile.storageAutogrow),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), \"Not Applicable\",\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), \"Not Applicable\",\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| extend ReplicationRole = case(\n type in ('microsoft.compute/virtualmachines', 'microsoft.classiccompute/virtualmachines', 'microsoft.compute/virtualmachinescalesets', 'microsoft.web/sites', 'microsoft.web/serverfarms', 'microsoft.containerservice/managedclusters', 'microsoft.documentdb/databaseaccounts'), \"Not Applicable\",\n (type == 'microsoft.sql/servers/databases' and sku.tier \u003c\u003e 'DataWarehouse'), iif(isnotempty(properties.secondaryType), \"replica\", \"master\"),\n (type == 'microsoft.sql/servers/databases' and sku.tier == 'DataWarehouse'), \"Not Applicable\",\n (type == 'microsoft.dbformysql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbformysql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/servers'), tostring(properties.replicationRole),\n (type == 'microsoft.dbforpostgresql/flexibleservers'), tostring(properties.replicationRole),\n (type == 'microsoft.cache/redis'), 'Not Applicable',\n (type == \"microsoft.apimanagement/service\"), \"Not Applicable\",\n (type contains \"storageaccounts\"), tostring(split(skuName, '_', 1)[0]),\n (type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (type == \"microsoft.network/frontdoors\"), \"Not Applicable\",\n (type == \"microsoft.cdn/profiles\"), \"Not Applicable\",\n (type == \"microsoft.network/applicationgateways\"), \"Not Applicable\",\n (type == \"microsoft.network/loadbalancers\"), \"Not Applicable\",\n (type contains \"publicip\"), \"Not Applicable\",\n (type == \"microsoft.network/virtualnetworkgateways\"), \"Not Applicable\",\n (type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Undefined\"\n )\n| project \n Type = tolower(type),\n SkuName = tolower(skuName),\n Kind = tolower(kind),\n SubscriptionId = subscriptionId,\n Name = tolower(tostring(id)),\n State = tolower(state),\n Location = tolower(location),\n ResourceGroup = resourceGroup,\n Zones = tolower(tostring(zones)),\n AvailabilityZone = tolower(avZones),\n AvailabilitySet = tolower(avSets),\n Capacity = tolower(Capacity),\n FaultDomain = tolower(FaultDomain),\n OSDisk = tolower(OSDisk),\n ReadReplica = tolower(ReadReplica), \n AutomaticFailover = tolower(AutomaticFailover),\n MultipleWriteLocations = tolower(MultipleWriteLocations),\n StorageAutogrow = tolower(StorageAutogrow),\n ReplicationRole = tolower(ReplicationRole),\n Environment = environment,\n properties\n| join kind = leftouter (\n recoveryservicesresources\n | extend vmId = case(\n properties.backupManagementType == \"AzureIaasVM\", tolower(tostring(properties.dataSourceInfo.resourceID)),\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(properties.providerSpecificDetails.dataSourceInfo.resourceId)),\n ''\n )\n | extend asrId = iff(type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", tolower(tostring(strcat_array(array_slice(split(properties.recoveryFabricId, '/'), 0, 8), '/'))), '')\n | extend resourceId = case(\n properties.backupManagementType == \"AzureIaasVM\", vmId,\n type == \"microsoft.recoveryservices/vaults/replicationfabrics/replicationprotectioncontainers/replicationprotecteditems\", asrId,\n ''\n )\n | extend Backup = tostring(properties.protectionStatus)\n | extend replicationHealth = properties.replicationHealth\n | extend failoverHealth = properties.failoverHealth\n | extend protectionStateDescription = properties.protectionStateDescription\n | extend isReplicationAgentUpdateRequired = properties.providerSpecificDetails.isReplicationAgentUpdateRequired\n | project resourceId, vmId, asrId, Backup, replicationHealth, failoverHealth, protectionStateDescription, isReplicationAgentUpdateRequired\n )\n on $left.Name == $right.resourceId\n| extend Backup = case(\n Backup == \"Healthy\" or Backup == \"Unhealthy\", Backup,\n \"Unknown\")\n| extend Backup = case(\n (Type == 'microsoft.compute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == 'microsoft.classiccompute/virtualmachines'), iif(Backup == \"Unknown\", \"Not Configured\", Backup),\n (Type == \"microsoft.compute/virtualmachinescalesets\"), \"Not Applicable\", \n (Type == \"microsoft.containerservice/managedclusters\"), \"Not Applicable\",\n (Type == 'microsoft.sql/servers/databases'), \"Not Applicable\",\n (Type == 'microsoft.documentdb/databaseaccounts'), iif(properties.backupPolicy.type!=\"Continuous\",iif(properties.backupPolicy.periodicModeProperties.backupStorageRedundancy == \"Geo\", \"Geo\", \"Not Geo\"),\"Continuous\"),\n (Type == 'microsoft.dbformysql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbformysql/flexibleservers'), properties.backup.geoRedundantBackup,\n (Type == 'microsoft.dbforpostgresql/servers'), iif(properties.storageProfile.geoRedundantBackup == \"Enabled\", \"Healthy\", \"Unhealthy\"),\n (Type == 'microsoft.dbforpostgresql/flexibleservers'), case(\n properties.backup.geoRedundantBackup == \"Disabled\" and properties.replicationRole !contains \"AsyncReplica\", \"Disabled\",\n properties.replicationRole == \"GeoAsyncReplica\", \"Not Applicable\",\n properties.replicationRole == \"AsyncReplica\", \"Not Applicable\",\n properties.backup.geoRedundantBackup\n ),\n (Type contains \"storageaccounts\"), \"Not Applicable\",\n (Type == \"microsoft.network/azurefirewalls\"), \"Not Applicable\",\n (Type == \"microsoft.recoveryservices/vaults\"), \"Not Applicable\",\n \"Unknown\"\n )\n| extend AvailabilitySet = case(\n AvailabilitySet == '-', 'None',\n isnotempty(AvailabilitySet), AvailabilitySet,\n \"Unknown\")\n\n| project Type, SkuName, Kind, SubscriptionId, Name, State, Location, ResourceGroup, Zones, AvailabilityZone, AvailabilitySet, Capacity, FaultDomain, OSDisk, ReadReplica, AutomaticFailover, MultipleWriteLocations, StorageAutogrow, ReplicationRole, Backup = tolower(Backup), Environment\n| where Type =~ \"microsoft.storage/storageaccounts\"\n",
"size": 3,
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "$gen_group",
"formatter": 13,
"formatOptions": {
"linkTarget": "Resource",
"showIcon": true
}
},
{
"columnMatch": "Type",
"formatter": 5
},
{
"columnMatch": "Name",
"formatter": 5
},
{
"columnMatch": "Kind",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "blobstorage",
"representation": "warning",
"text": "{0}{1}"
},
{
"operator": "==",
"thresholdValue": "storage",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "success",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "SubscriptionId",
"formatter": 5
},
{
"columnMatch": "Location",
"formatter": 17
},
{
"columnMatch": "Zones",
"formatter": 5
},
{
"columnMatch": "AvailabilityZone",
"formatter": 5
},
{
"columnMatch": "AvailabilitySet",
"formatter": 5
},
{
"columnMatch": "Capacity",
"formatter": 5
},
{
"columnMatch": "FaultDomain",
"formatter": 5
},
{
"columnMatch": "OSDisk",
"formatter": 5
},
{
"columnMatch": "ReadReplica",
"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": "AutomaticFailover",
"formatter": 5
},
{
"columnMatch": "MultipleWriteLocations",
"formatter": 5
},
{
"columnMatch": "StorageAutogrow",
"formatter": 5
},
{
"columnMatch": "Backup",
"formatter": 5
},
{
"columnMatch": "Environment",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "Prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "SubscriptionName",
"formatter": 5
},
{
"columnMatch": "AccessTier",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "Hot",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "2",
"text": "Warning"
}
]
}
},
{
"columnMatch": "ReplicationRole",
"formatter": 1
},
{
"columnMatch": "type",
"formatter": 5
}
],
"rowLimit": 10000,
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"SubscriptionId"
],
"expandTopLevel": false,
"finalBy": "Name"
},
"labelSettings": [
{
"columnId": "SkuName",
"label": "Sku Name"
},
{
"columnId": "SubscriptionId",
"label": "Subscription"
},
{
"columnId": "ResourceGroup",
"label": "Resource Group"
},
{
"columnId": "ReadReplica",
"label": "Replication"
},
{
"columnId": "ReplicationRole",
"label": "Replication Type"
}
]
}
},
"name": "kql_storage_account_resources_details"
},
{
"type": 1,
"content": {
"json": "* Classic Storage Account are in path of retirement. Please migrate to Resource Manager based Storage Accounts immediately\r\n\r\n> Retirement announcement in the [docs](https://learn.microsoft.com/azure/storage/common/classic-account-migration-overview)",
"style": "warning"
},
"name": "text - 6"
},
{
"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.classicstorage/storageaccounts\"\n",
"size": 3,
"title": "Classic Storage Account",
"showExportToExcel": true,
"queryType": 1,
"resourceType": "microsoft.resourcegraph/resources",
"crossComponentResources": [
"{Subscriptions}"
],
"gridSettings": {
"formatters": [
{
"columnMatch": "$gen_group",
"formatter": 13,
"formatOptions": {
"linkTarget": "Resource",
"showIcon": true
}
},
{
"columnMatch": "Subscription",
"formatter": 13,
"formatOptions": {
"linkTarget": "Resource",
"showIcon": true
}
},
{
"columnMatch": "Type",
"formatter": 5
},
{
"columnMatch": "Name",
"formatter": 5
},
{
"columnMatch": "Kind",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "Default",
"thresholdValue": null,
"representation": "2",
"text": "Classic"
}
]
}
},
{
"columnMatch": "SubscriptionId",
"formatter": 5
},
{
"columnMatch": "Location",
"formatter": 17
},
{
"columnMatch": "Zones",
"formatter": 5
},
{
"columnMatch": "AvailabilityZone",
"formatter": 5
},
{
"columnMatch": "AvailabilitySet",
"formatter": 5
},
{
"columnMatch": "Capacity",
"formatter": 5
},
{
"columnMatch": "FaultDomain",
"formatter": 5
},
{
"columnMatch": "OSDisk",
"formatter": 5
},
{
"columnMatch": "ReadReplica",
"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": "AutomaticFailover",
"formatter": 5
},
{
"columnMatch": "MultipleWriteLocations",
"formatter": 5
},
{
"columnMatch": "StorageAutogrow",
"formatter": 5
},
{
"columnMatch": "Backup",
"formatter": 5
},
{
"columnMatch": "Environment",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "colors",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "Prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "prod",
"representation": "redBright",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "SubscriptionName",
"formatter": 5
},
{
"columnMatch": "SecondaryLocation",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "-",
"representation": "2",
"text": "Warning"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "success",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "SecondaryStatus",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "Available",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "2",
"text": "Warning"
}
]
}
},
{
"columnMatch": "AccessTier",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "==",
"thresholdValue": "Hot",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "2",
"text": "Warning"
}
]
}
},
{
"columnMatch": "ReplicationRole",
"formatter": 18,
"formatOptions": {
"thresholdsOptions": "icons",
"thresholdsGrid": [
{
"operator": "contains",
"thresholdValue": "ra-grs",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "ra-gzrs",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "grs",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "zrs",
"representation": "success",
"text": "{0}{1}"
},
{
"operator": "contains",
"thresholdValue": "lrs",
"representation": "2",
"text": "{0}{1}"
},
{
"operator": "Default",
"thresholdValue": null,
"representation": "2",
"text": "{0}{1}"
}
]
}
},
{
"columnMatch": "type",
"formatter": 5
}
],
"rowLimit": 10000,
"hierarchySettings": {
"treeType": 1,
"groupBy": [
"SubscriptionId"
],
"expandTopLevel": false,
"finalBy": "Name"
},
"labelSettings": [
{
"columnId": "SkuName",
"label": "Sku Name"
},
{
"columnId": "SubscriptionId",
"label": "Subscription"
},
{
"columnId": "ResourceGroup",
"label": "Resource Group"
},
{
"columnId": "ReadReplica",
"label": "Read Replication"
},
{
"columnId": "ReplicationRole",
"label": "Replication Type"
}
]
}
},
"name": "kql_storage_account_classic_resources_details"
}
]
}