You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/management/includes/tags.md
+20-31Lines changed: 20 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,25 @@
1
1
---
2
-
author: davidsmatlak
3
-
ms.service: resource-graph
2
+
ms.service: azure-resource-manager
4
3
ms.topic: include
5
4
ms.date: 07/07/2022
6
-
ms.author: davidsmatlak
7
-
ms.custom: generated
5
+
author: mumian
6
+
ms.author: jgao
8
7
---
9
8
10
9
### Find storage accounts with a specific case-insensitive tag on the resource group
11
10
12
-
Similar to the 'Find storage accounts with a specific case-sensitive tag on the resource group' query, but when it's necessary to look for a case insensitive tag name and tag value, use `mv-expand` with the **bagexpansion** parameter. This query uses more quota than the original query, so use `mv-expand` only if necessary.
11
+
Similar to the 'Find storage accounts with a specific case-sensitive tag on the resource group' query, but when it's necessary to look for a case insensitive tag name and tag value, use `mv-expand` with the `bagexpansion` parameter. This query uses more quota than the original query, so use `mv-expand` only if necessary.
13
12
14
13
```kusto
15
14
Resources
16
15
| where type =~ 'microsoft.storage/storageaccounts'
17
16
| join kind=inner (
18
-
ResourceContainers
19
-
| where type =~ 'microsoft.resources/subscriptions/resourcegroups'
20
-
| mv-expand bagexpansion=array tags
21
-
| where isnotempty(tags)
22
-
| where tags[0] =~ 'key1' and tags[1] =~ 'value1'
23
-
| project subscriptionId, resourceGroup)
17
+
ResourceContainers
18
+
| where type =~ 'microsoft.resources/subscriptions/resourcegroups'
19
+
| mv-expand bagexpansion=array tags
20
+
| where isnotempty(tags)
21
+
| where tags[0] =~ 'key1' and tags[1] =~ 'value1'
22
+
| project subscriptionId, resourceGroup)
24
23
on subscriptionId, resourceGroup
25
24
| project-away subscriptionId1, resourceGroup1
26
25
```
@@ -39,8 +38,6 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.storage/storageaccou
- Azure Government portal: <ahref="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20where%20type%20%3d%7e%20%27microsoft.storage%2fstorageaccounts%27%0a%7c%20join%20kind%3dinner%20(%0a%09ResourceContainers%0a%09%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%2fresourcegroups%27%0a%09%7c%20mv-expand%20bagexpansion%3darray%20tags%0a%09%7c%20where%20isnotempty(tags)%0a%09%7c%20where%20tags%5b0%5d%20%3d%7e%20%27key1%27%20and%20tags%5b1%5d%20%3d%7e%20%27value1%27%0a%09%7c%20project%20subscriptionId%2c%20resourceGroup)%0aon%20subscriptionId%2c%20resourceGroup%0a%7c%20project-away%20subscriptionId1%2c%20resourceGroup1"target="_blank">portal.azure.us</a>
46
43
- Microsoft Azure operated by 21Vianet portal: <ahref="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20where%20type%20%3d%7e%20%27microsoft.storage%2fstorageaccounts%27%0a%7c%20join%20kind%3dinner%20(%0a%09ResourceContainers%0a%09%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%2fresourcegroups%27%0a%09%7c%20mv-expand%20bagexpansion%3darray%20tags%0a%09%7c%20where%20isnotempty(tags)%0a%09%7c%20where%20tags%5b0%5d%20%3d%7e%20%27key1%27%20and%20tags%5b1%5d%20%3d%7e%20%27value1%27%0a%09%7c%20project%20subscriptionId%2c%20resourceGroup)%0aon%20subscriptionId%2c%20resourceGroup%0a%7c%20project-away%20subscriptionId1%2c%20resourceGroup1"target="_blank">portal.azure.cn</a>
@@ -55,10 +52,10 @@ The following query uses an **inner** `join` to connect storage accounts with re
55
52
Resources
56
53
| where type =~ 'microsoft.storage/storageaccounts'
57
54
| join kind=inner (
58
-
ResourceContainers
59
-
| where type =~ 'microsoft.resources/subscriptions/resourcegroups'
60
-
| where tags['Key1'] =~ 'Value1'
61
-
| project subscriptionId, resourceGroup)
55
+
ResourceContainers
56
+
| where type =~ 'microsoft.resources/subscriptions/resourcegroups'
57
+
| where tags['Key1'] =~ 'Value1'
58
+
| project subscriptionId, resourceGroup)
62
59
on subscriptionId, resourceGroup
63
60
| project-away subscriptionId1, resourceGroup1
64
61
```
@@ -77,8 +74,6 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.storage/storageaccou
- Azure Government portal: <ahref="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20where%20type%20%3d%7e%20%27microsoft.storage%2fstorageaccounts%27%0a%7c%20join%20kind%3dinner%20(%0a%09ResourceContainers%0a%09%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%2fresourcegroups%27%0a%09%7c%20where%20tags%5b%27Key1%27%5d%20%3d%7e%20%27Value1%27%0a%09%7c%20project%20subscriptionId%2c%20resourceGroup)%0aon%20subscriptionId%2c%20resourceGroup%0a%7c%20project-away%20subscriptionId1%2c%20resourceGroup1"target="_blank">portal.azure.us</a>
84
79
- Azure operated by 21Vianet portal: <ahref="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20where%20type%20%3d%7e%20%27microsoft.storage%2fstorageaccounts%27%0a%7c%20join%20kind%3dinner%20(%0a%09ResourceContainers%0a%09%7c%20where%20type%20%3d%7e%20%27microsoft.resources%2fsubscriptions%2fresourcegroups%27%0a%09%7c%20where%20tags%5b%27Key1%27%5d%20%3d%7e%20%27Value1%27%0a%09%7c%20project%20subscriptionId%2c%20resourceGroup)%0aon%20subscriptionId%2c%20resourceGroup%0a%7c%20project-away%20subscriptionId1%2c%20resourceGroup1"target="_blank">portal.azure.cn</a>
- Azure Government portal: <ahref="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20project%20tags%0a%7c%20summarize%20buildschema(tags)"target="_blank">portal.azure.us</a>
116
109
- Azure operated by 21Vianet portal: <ahref="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20project%20tags%0a%7c%20summarize%20buildschema(tags)"target="_blank">portal.azure.cn</a>
@@ -129,12 +122,12 @@ ResourceContainers
129
122
| extend tagKey = tostring(bag_keys(tags)[0])
130
123
| extend tagValue = tostring(tags[tagKey])
131
124
| union (
132
-
resources
133
-
| where isnotempty(tags)
134
-
| project tags
135
-
| mvexpand tags
136
-
| extend tagKey = tostring(bag_keys(tags)[0])
137
-
| extend tagValue = tostring(tags[tagKey])
125
+
resources
126
+
| where isnotempty(tags)
127
+
| project tags
128
+
| mvexpand tags
129
+
| extend tagKey = tostring(bag_keys(tags)[0])
130
+
| extend tagValue = tostring(tags[tagKey])
138
131
)
139
132
| distinct tagKey, tagValue
140
133
| where tagKey !startswith "hidden-"
@@ -154,8 +147,6 @@ Search-AzGraph -Query "ResourceContainers | where isnotempty(tags) | project tag
- Azure Government portal: <ahref="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20isnotempty(tags)%0a%7c%20project%20tags%0a%7c%20mvexpand%20tags%0a%7c%20extend%20tagKey%20%3d%20tostring(bag_keys(tags)%5b0%5d)%0a%7c%20extend%20tagValue%20%3d%20tostring(tags%5btagKey%5d)%0a%7c%20union%20(%0a%09resources%0a%09%7c%20where%20isnotempty(tags)%0a%09%7c%20project%20tags%0a%09%7c%20mvexpand%20tags%0a%09%7c%20extend%20tagKey%20%3d%20tostring(bag_keys(tags)%5b0%5d)%0a%09%7c%20extend%20tagValue%20%3d%20tostring(tags%5btagKey%5d)%0a)%0a%7c%20distinct%20tagKey%2c%20tagValue%0a%7c%20where%20tagKey%20!startswith%20%22hidden-%22"target="_blank">portal.azure.us</a>
161
152
- Azure operated by 21Vianet portal: <ahref="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/ResourceContainers%0a%7c%20where%20isnotempty(tags)%0a%7c%20project%20tags%0a%7c%20mvexpand%20tags%0a%7c%20extend%20tagKey%20%3d%20tostring(bag_keys(tags)%5b0%5d)%0a%7c%20extend%20tagValue%20%3d%20tostring(tags%5btagKey%5d)%0a%7c%20union%20(%0a%09resources%0a%09%7c%20where%20isnotempty(tags)%0a%09%7c%20project%20tags%0a%09%7c%20mvexpand%20tags%0a%09%7c%20extend%20tagKey%20%3d%20tostring(bag_keys(tags)%5b0%5d)%0a%09%7c%20extend%20tagValue%20%3d%20tostring(tags%5btagKey%5d)%0a)%0a%7c%20distinct%20tagKey%2c%20tagValue%0a%7c%20where%20tagKey%20!startswith%20%22hidden-%22"target="_blank">portal.azure.cn</a>
- Azure Government portal: <ahref="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20where%20tags.environment%3d%7e%27internal%27%0a%7c%20project%20name%2c%20tags"target="_blank">portal.azure.us</a>
193
182
- Azure operated by 21Vianet portal: <ahref="https://portal.azure.cn/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20where%20tags.environment%3d%7e%27internal%27%0a%7c%20project%20name%2c%20tags"target="_blank">portal.azure.cn</a>
# Azure Resource Graph sample queries for Azure Resource Manager
10
10
11
-
This page is a collection of [Azure Resource Graph](../../governance/resource-graph/overview.md) sample queries for Azure Resource Manager. For a complete list of Azure Resource Graph samples, see
12
-
[Resource Graph samples by Category](../../governance/resource-graph/samples/samples-by-category.md) and [Resource Graph samples by Table](../../governance/resource-graph/samples/samples-by-table.md).
13
-
11
+
This page is a collection of [Azure Resource Graph](../../governance/resource-graph/overview.md) sample queries for Azure Resource Manager.
0 commit comments