Skip to content

Commit 13e930e

Browse files
author
Jill Grant
authored
Merge pull request #277932 from davidsmatlak/ds-arg-move-armmanagement
Moves ARM Management include file for ARG sample
2 parents fc7568d + 1f8c465 commit 13e930e

File tree

2 files changed

+22
-37
lines changed

2 files changed

+22
-37
lines changed

includes/resource-graph/samples/bycat/tags.md renamed to articles/azure-resource-manager/management/includes/tags.md

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
---
2-
author: davidsmatlak
3-
ms.service: resource-graph
2+
ms.service: azure-resource-manager
43
ms.topic: include
54
ms.date: 07/07/2022
6-
ms.author: davidsmatlak
7-
ms.custom: generated
5+
author: mumian
6+
ms.author: jgao
87
---
98

109
### Find storage accounts with a specific case-insensitive tag on the resource group
1110

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.
1312

1413
```kusto
1514
Resources
1615
| where type =~ 'microsoft.storage/storageaccounts'
1716
| 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)
2423
on subscriptionId, resourceGroup
2524
| project-away subscriptionId1, resourceGroup1
2625
```
@@ -39,8 +38,6 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.storage/storageaccou
3938

4039
# [Portal](#tab/azure-portal)
4140

42-
43-
4441
- Azure portal: <a href="https://portal.azure.com/#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.com</a>
4542
- Azure Government portal: <a href="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>
4643
- Microsoft Azure operated by 21Vianet portal: <a href="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
5552
Resources
5653
| where type =~ 'microsoft.storage/storageaccounts'
5754
| 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)
6259
on subscriptionId, resourceGroup
6360
| project-away subscriptionId1, resourceGroup1
6461
```
@@ -77,8 +74,6 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.storage/storageaccou
7774

7875
# [Portal](#tab/azure-portal)
7976

80-
81-
8277
- Azure portal: <a href="https://portal.azure.com/#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.com</a>
8378
- Azure Government portal: <a href="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>
8479
- Azure operated by 21Vianet portal: <a href="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>
@@ -109,8 +104,6 @@ Search-AzGraph -Query "Resources | project tags | summarize buildschema(tags)"
109104

110105
# [Portal](#tab/azure-portal)
111106

112-
113-
114107
- Azure portal: <a href="https://portal.azure.com/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20project%20tags%0a%7c%20summarize%20buildschema(tags)" target="_blank">portal.azure.com</a>
115108
- Azure Government portal: <a href="https://portal.azure.us/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20project%20tags%0a%7c%20summarize%20buildschema(tags)" target="_blank">portal.azure.us</a>
116109
- Azure operated by 21Vianet portal: <a href="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
129122
| extend tagKey = tostring(bag_keys(tags)[0])
130123
| extend tagValue = tostring(tags[tagKey])
131124
| 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])
138131
)
139132
| distinct tagKey, tagValue
140133
| where tagKey !startswith "hidden-"
@@ -154,8 +147,6 @@ Search-AzGraph -Query "ResourceContainers | where isnotempty(tags) | project tag
154147

155148
# [Portal](#tab/azure-portal)
156149

157-
158-
159150
- Azure portal: <a href="https://portal.azure.com/#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.com</a>
160151
- Azure Government portal: <a href="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>
161152
- Azure operated by 21Vianet portal: <a href="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>
@@ -186,8 +177,6 @@ Search-AzGraph -Query "Resources | where tags.environment=~'internal' | project
186177

187178
# [Portal](#tab/azure-portal)
188179

189-
190-
191180
- Azure portal: <a href="https://portal.azure.com/#blade/HubsExtension/ArgQueryBlade/query/Resources%0a%7c%20where%20tags.environment%3d%7e%27internal%27%0a%7c%20project%20name%2c%20tags" target="_blank">portal.azure.com</a>
192181
- Azure Government portal: <a href="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>
193182
- Azure operated by 21Vianet portal: <a href="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>

articles/azure-resource-manager/management/resource-graph-samples.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,12 @@ ms.custom: subject-resourcegraph-sample, devx-track-azurepowershell, devx-track-
88

99
# Azure Resource Graph sample queries for Azure Resource Manager
1010

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.
1412
## Sample queries for tags
1513

16-
[!INCLUDE [azure-resource-graph-samples-cat-tags](../../../includes/resource-graph/samples/bycat/tags.md)]
14+
[!INCLUDE [azure-resource-graph-samples-cat-tags](./includes/tags.md)]
1715

1816
## Next steps
1917

2018
- Learn more about the [query language](../../governance/resource-graph/concepts/query-language.md).
2119
- Learn more about how to [explore resources](../../governance/resource-graph/concepts/explore-resources.md).
22-
- See samples of [Starter language queries](../../governance/resource-graph/samples/starter.md).
23-
- See samples of [Advanced language queries](../../governance/resource-graph/samples/advanced.md).

0 commit comments

Comments
 (0)