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
You can query by the scopes for management group and tenant. Replace `<managementGroupId>`with your value. The `UseTenantScope` parameter doesn't require a value.
- Azure Government portal: <ahref="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/authorizationresources%0D%0A%7C%20summarize%20count%28%29"target="_blank">portal.azure.us</a>
79
+
- Microsoft Azure operated by 21Vianet portal: <ahref="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/authorizationresources%0D%0A%7C%20summarize%20count%28%29"target="_blank">portal.azure.cn</a>
The `authorizationresources` table can be used to trouble Azure role-based access control (Azure RBAC) if you exceed limits. For more information, go to [Troubleshoot Azure RBAC limits](../../../../role-based-access-control/troubleshoot-limits.md).
11
+
The `authorizationresources` table can be used to troubleshoot Azure role-based access control (Azure RBAC) if you exceed limits. For more information, go to [Troubleshoot Azure RBAC limits](../../../../role-based-access-control/troubleshoot-limits.md).
You can query by the scopes for management group and tenant. Replace `<managementGroupId>`with your value. The `UseTenantScope` parameter doesn't require a value.
:::image type="icon" source="../media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer:
@@ -89,7 +134,7 @@ Resources
89
134
90
135
# [Azure CLI](#tab/azure-cli)
91
136
92
-
```azurecli
137
+
```azurecli-interactive
93
138
az graph query -q "Resources | where type =~ 'microsoft.keyvault/vaults' | count"
94
139
```
95
140
@@ -123,7 +168,7 @@ Resources
123
168
124
169
# [Azure CLI](#tab/azure-cli)
125
170
126
-
```azurecli
171
+
```azurecli-interactive
127
172
az graph query -q "Resources | project name, type, location | order by name asc"
128
173
```
129
174
@@ -158,7 +203,7 @@ Resources
158
203
159
204
# [Azure CLI](#tab/azure-cli)
160
205
161
-
```azurecli
206
+
```azurecli-interactive
162
207
az graph query -q "Resources | project name, location, type| where type =~ 'Microsoft.Compute/virtualMachines' | order by name desc"
163
208
```
164
209
@@ -180,7 +225,7 @@ Search-AzGraph -Query "Resources | project name, location, type| where type =~ '
180
225
181
226
## <aname="show-sorted"></a>Show first five virtual machines by name and their OS type
182
227
183
-
This query will use`top` to only retrieve five matching records that are ordered by name. The type
228
+
This query uses`top` to only retrieve five matching records that are ordered by name. The type
184
229
of the Azure resource is `Microsoft.Compute/virtualMachines`. `project` tells Azure Resource Graph
185
230
which properties to include.
186
231
@@ -193,7 +238,7 @@ Resources
193
238
194
239
# [Azure CLI](#tab/azure-cli)
195
240
196
-
```azurecli
241
+
```azurecli-interactive
197
242
az graph query -q "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project name, properties.storageProfile.osDisk.osType | top 5 by name desc"
198
243
```
199
244
@@ -230,7 +275,7 @@ Resources
230
275
231
276
# [Azure CLI](#tab/azure-cli)
232
277
233
-
```azurecli
278
+
```azurecli-interactive
234
279
az graph query -q "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)"
235
280
```
236
281
@@ -263,7 +308,7 @@ Resources
263
308
264
309
# [Azure CLI](#tab/azure-cli)
265
310
266
-
```azurecli
311
+
```azurecli-interactive
267
312
az graph query -q "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | extend os = properties.storageProfile.osDisk.osType | summarize count() by tostring(os)"
268
313
```
269
314
@@ -291,7 +336,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
291
336
292
337
## <aname="show-storage"></a>Show resources that contain storage
293
338
294
-
Instead of explicitly defining the type to match, this example query will find any Azure resource
339
+
Instead of explicitly defining the type to match, this example query finds any Azure resource
295
340
that `contains` the word **storage**.
296
341
297
342
```kusto
@@ -301,7 +346,7 @@ Resources
301
346
302
347
# [Azure CLI](#tab/azure-cli)
303
348
304
-
```azurecli
349
+
```azurecli-interactive
305
350
az graph query -q "Resources | where type contains 'storage' | distinct type"
306
351
```
307
352
@@ -335,7 +380,7 @@ Resources
335
380
336
381
# [Azure CLI](#tab/azure-cli)
337
382
338
-
```azurecli
383
+
```azurecli-interactive
339
384
az graph query -q "Resources | where type == 'microsoft.network/virtualnetworks' | extend subnets = properties.subnets | mv-expand subnets | project name, subnets.name, subnets.properties.addressPrefix, location, resourceGroup, subscriptionId"
340
385
```
341
386
@@ -371,7 +416,7 @@ Resources
371
416
372
417
# [Azure CLI](#tab/azure-cli)
373
418
374
-
```azurecli
419
+
```azurecli-interactive
375
420
az graph query -q "Resources | where type contains 'publicIPAddresses' and isnotempty(properties.ipAddress) | project properties.ipAddress | limit 100"
376
421
```
377
422
@@ -403,7 +448,7 @@ Resources
403
448
404
449
# [Azure CLI](#tab/azure-cli)
405
450
406
-
```azurecli
451
+
```azurecli-interactive
407
452
az graph query -q "Resources | where type contains 'publicIPAddresses' and isnotempty(properties.ipAddress) | summarize count () by subscriptionId"
408
453
```
409
454
@@ -437,7 +482,7 @@ Resources
437
482
438
483
# [Azure CLI](#tab/azure-cli)
439
484
440
-
```azurecli
485
+
```azurecli-interactive
441
486
az graph query -q "Resources | where tags.environment=~'internal' | project name"
442
487
```
443
488
@@ -468,7 +513,7 @@ Resources
468
513
469
514
# [Azure CLI](#tab/azure-cli)
470
515
471
-
```azurecli
516
+
```azurecli-interactive
472
517
az graph query -q "Resources | where tags.environment=~'internal' | project name, tags"
473
518
```
474
519
@@ -502,7 +547,7 @@ Resources
502
547
503
548
# [Azure CLI](#tab/azure-cli)
504
549
505
-
```azurecli
550
+
```azurecli-interactive
506
551
az graph query -q "Resources | where type =~ 'Microsoft.Storage/storageAccounts' | where tags['tag with a space']=='Custom value'"
az graph query -q "Resources | where type =~ 'microsoft.network/networksecuritygroups' and isnull(properties.networkInterfaces) and isnull(properties.subnets) | project name, resourceGroup | sort by name asc"
0 commit comments