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/governance/resource-graph/concepts/work-with-data.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,7 @@ of the data set instead.
65
65
The following examples show how to skip the first _10_ records a query would result in, instead
66
66
starting the returned result set with the 11th record:
67
67
68
-
```azurecli-interactive
68
+
```azurecli
69
69
az graph query -q "Resources | project name | order by name asc" --skip 10 --output table
70
70
```
71
71
@@ -87,7 +87,7 @@ consumer if there are more records not returned in the response. This condition
87
87
identified when the **count** property is less than the **totalRecords** property. **totalRecords**
88
88
defines how many records that match the query.
89
89
90
-
**resultTruncated** is **true** when there are less resources available than a query is requesting or when paging is disabled or when paging is not possible because:
90
+
**resultTruncated** is **true** when there are less resources available than a query is requesting or when paging is disabled or when paging is not possible because:
91
91
92
92
- The query contains a `limit` or `sample`/`take` operator.
93
93
-**All** output columns are either `dynamic` or `null` type.
@@ -97,7 +97,7 @@ When **resultTruncated** is **true**, the **$skipToken** property isn't set.
97
97
The following examples show how to **skip** the first 3,000 records and return the **first** 1,000
98
98
records after those records skipped with Azure CLI and Azure PowerShell:
99
99
100
-
```azurecli-interactive
100
+
```azurecli
101
101
az graph query -q "Resources | project id, name | order by id asc" --first 1000 --skip 3000
102
102
```
103
103
@@ -108,7 +108,7 @@ Search-AzGraph -Query "Resources | project id, name | order by id asc" -First 10
108
108
> [!IMPORTANT]
109
109
> The response won't include the **$skipToken** if:
110
110
> - The query contains a `limit` or `sample`/`take` operator.
111
-
> -**All** output columns are either `dynamic` or `null` type.
111
+
> -**All** output columns are either `dynamic` or `null` type.
az graph query -q "Resources | where type =~ 'microsoft.compute/virtualmachines' and name matches regex @'^Contoso(.*)[0-9]+\$' | project name | order by name asc"
211
211
```
212
212
@@ -244,7 +244,7 @@ Resources
244
244
245
245
# [Azure CLI](#tab/azure-cli)
246
246
247
-
```azurecli-interactive
247
+
```azurecli
248
248
az graph query -q "Resources | where type =~ 'microsoft.documentdb/databaseaccounts' | project id, name, writeLocations = (properties.writeLocations) | mv-expand writeLocations | project id, name, writeLocation = tostring(writeLocations.locationName) | where writeLocation in ('East US', 'West US') | summarize by id, name"
249
249
```
250
250
@@ -282,7 +282,7 @@ Resources
282
282
283
283
# [Azure CLI](#tab/azure-cli)
284
284
285
-
```azurecli-interactive
285
+
```azurecli
286
286
az graph query -q "Resources | join kind=leftouter (ResourceContainers | where type=='microsoft.resources/subscriptions' | project SubName=name, subscriptionId) on subscriptionId | where type == 'microsoft.keyvault/vaults' | project type, name, SubName"
287
287
```
288
288
@@ -321,7 +321,7 @@ on elasticPoolId
321
321
322
322
# [Azure CLI](#tab/azure-cli)
323
323
324
-
```azurecli-interactive
324
+
```azurecli
325
325
az graph query -q "Resources | where type =~ 'microsoft.sql/servers/databases' | project databaseId = id, databaseName = name, elasticPoolId = tolower(tostring(properties.elasticPoolId)) | join kind=leftouter ( Resources | where type =~ 'microsoft.sql/servers/elasticpools' | project elasticPoolId = tolower(id), elasticPoolName = name, elasticPoolState = properties.state) on elasticPoolId | project-away elasticPoolId1"
326
326
```
327
327
@@ -374,7 +374,7 @@ on publicIpId
374
374
375
375
# [Azure CLI](#tab/azure-cli)
376
376
377
-
```azurecli-interactive
377
+
```azurecli
378
378
az graph query -q "Resources | where type =~ 'microsoft.compute/virtualmachines' | extend nics=array_length(properties.networkProfile.networkInterfaces) | mv-expand nic=properties.networkProfile.networkInterfaces | where nics == 1 or nic.properties.primary =~ 'true' or isempty(nic) | project vmId = id, vmName = name, vmSize=tostring(properties.hardwareProfile.vmSize), nicId = tostring(nic.id) | join kind=leftouter ( Resources | where type =~ 'microsoft.network/networkinterfaces' | extend ipConfigsCount=array_length(properties.ipConfigurations) | mv-expand ipconfig=properties.ipConfigurations | where ipConfigsCount == 1 or ipconfig.properties.primary =~ 'true' | project nicId = id, publicIpId = tostring(ipconfig.properties.publicIPAddress.id)) on nicId | project-away nicId1 | summarize by vmId, vmName, vmSize, nicId, publicIpId | join kind=leftouter ( Resources | where type =~ 'microsoft.network/publicipaddresses' | project publicIpId = id, publicIpAddress = properties.ipAddress) on publicIpId | project-away publicIpId1"
379
379
```
380
380
@@ -428,7 +428,7 @@ Resources
428
428
429
429
# [Azure CLI](#tab/azure-cli)
430
430
431
-
```azurecli-interactive
431
+
```azurecli
432
432
az graph query -q "Resources | where type == 'microsoft.compute/virtualmachines' | extend JoinID = toupper(id), OSName = tostring(properties.osProfile.computerName), OSType = tostring(properties.storageProfile.osDisk.osType), VMSize = tostring(properties.hardwareProfile.vmSize) | join kind=leftouter( Resources | where type == 'microsoft.compute/virtualmachines/extensions' | extend VMId = toupper(substring(id, 0, indexof(id, '/extensions'))), ExtensionName = name ) on \$left.JoinID == \$right.VMId | summarize Extensions = make_list(ExtensionName) by id, OSName, OSType, VMSize | order by tolower(OSName) asc"
433
433
```
434
434
@@ -467,7 +467,7 @@ on subscriptionId, resourceGroup
467
467
468
468
# [Azure CLI](#tab/azure-cli)
469
469
470
-
```azurecli-interactive
470
+
```azurecli
471
471
az graph query -q "Resources | where type =~ 'microsoft.storage/storageaccounts' | join kind=inner ( ResourceContainers | where type =~ 'microsoft.resources/subscriptions/resourcegroups' | where tags['Key1'] =~ 'Value1' | project subscriptionId, resourceGroup) on subscriptionId, resourceGroup | project-away subscriptionId1, resourceGroup1"
472
472
```
473
473
@@ -507,7 +507,7 @@ on subscriptionId, resourceGroup
507
507
508
508
# [Azure CLI](#tab/azure-cli)
509
509
510
-
```azurecli-interactive
510
+
```azurecli
511
511
az graph query -q "Resources | where type =~ 'microsoft.storage/storageaccounts' | join kind=inner ( ResourceContainers | where type =~ 'microsoft.resources/subscriptions/resourcegroups' | mv-expand bagexpansion=array tags | where isnotempty(tags) | where tags[0] =~ 'key1' and tags[1] =~ 'value1' | project subscriptionId, resourceGroup) on subscriptionId, resourceGroup | project-away subscriptionId1, resourceGroup1"
512
512
```
513
513
@@ -540,7 +540,7 @@ ResourceContainers
540
540
541
541
# [Azure CLI](#tab/azure-cli)
542
542
543
-
```azurecli-interactive
543
+
```azurecli
544
544
az graph query -q "ResourceContainers | where type=='microsoft.resources/subscriptions/resourcegroups' | project name, type | limit 5 | union (Resources | project name, type | limit 5)"
| parse kind=regex subnetId with '/virtualNetworks/' virtualNetwork '/subnets/' subnet
575
+
| parse kind=regex subnetId with '/virtualNetworks/' virtualNetwork '/subnets/' subnet
576
576
| project id, virtualNetwork, subnet
577
577
```
578
578
579
579
# [Azure CLI](#tab/azure-cli)
580
580
581
-
```azurecli-interactive
581
+
```azurecli
582
582
az graph query -q "Resources | where type =~ 'microsoft.network/networkinterfaces' | project id, ipConfigurations = properties.ipConfigurations | mvexpand ipConfigurations | project id, subnetId = tostring(ipConfigurations.properties.subnet.id) | parse kind=regex subnetId with '/virtualNetworks/' virtualNetwork '/subnets/' subnet | project id, virtualNetwork, subnet"
583
583
```
584
584
@@ -612,7 +612,7 @@ Resources
612
612
613
613
# [Azure CLI](#tab/azure-cli)
614
614
615
-
```azurecli-interactive
615
+
```azurecli
616
616
az graph query -q "Resources | where type == 'microsoft.compute/virtualmachines' | summarize count() by tostring(properties.extended.instanceView.powerState.code)"
Copy file name to clipboardExpand all lines: articles/governance/resource-graph/samples/starter.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ Resources
52
52
53
53
# [Azure CLI](#tab/azure-cli)
54
54
55
-
```azurecli-interactive
55
+
```azurecli
56
56
az graph query -q "Resources | summarize count()"
57
57
```
58
58
@@ -85,7 +85,7 @@ Resources
85
85
86
86
# [Azure CLI](#tab/azure-cli)
87
87
88
-
```azurecli-interactive
88
+
```azurecli
89
89
az graph query -q "Resources | where type =~ 'microsoft.keyvault/vaults' | count"
90
90
```
91
91
@@ -119,7 +119,7 @@ Resources
119
119
120
120
# [Azure CLI](#tab/azure-cli)
121
121
122
-
```azurecli-interactive
122
+
```azurecli
123
123
az graph query -q "Resources | project name, type, location | order by name asc"
124
124
```
125
125
@@ -154,7 +154,7 @@ Resources
154
154
155
155
# [Azure CLI](#tab/azure-cli)
156
156
157
-
```azurecli-interactive
157
+
```azurecli
158
158
az graph query -q "Resources | project name, location, type| where type =~ 'Microsoft.Compute/virtualMachines' | order by name desc"
159
159
```
160
160
@@ -189,7 +189,7 @@ Resources
189
189
190
190
# [Azure CLI](#tab/azure-cli)
191
191
192
-
```azurecli-interactive
192
+
```azurecli
193
193
az graph query -q "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project name, properties.storageProfile.osDisk.osType | top 5 by name desc"
194
194
```
195
195
@@ -226,7 +226,7 @@ Resources
226
226
227
227
# [Azure CLI](#tab/azure-cli)
228
228
229
-
```azurecli-interactive
229
+
```azurecli
230
230
az graph query -q "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)"
231
231
```
232
232
@@ -259,7 +259,7 @@ Resources
259
259
260
260
# [Azure CLI](#tab/azure-cli)
261
261
262
-
```azurecli-interactive
262
+
```azurecli
263
263
az graph query -q "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | extend os = properties.storageProfile.osDisk.osType | summarize count() by tostring(os)"
264
264
```
265
265
@@ -297,7 +297,7 @@ Resources
297
297
298
298
# [Azure CLI](#tab/azure-cli)
299
299
300
-
```azurecli-interactive
300
+
```azurecli
301
301
az graph query -q "Resources | where type contains 'storage' | distinct type"
302
302
```
303
303
@@ -333,7 +333,7 @@ Resources
333
333
334
334
# [Azure CLI](#tab/azure-cli)
335
335
336
-
```azurecli-interactive
336
+
```azurecli
337
337
az graph query -q "Resources | where type contains 'publicIPAddresses' and isnotempty(properties.ipAddress) | project properties.ipAddress | limit 100"
338
338
```
339
339
@@ -365,7 +365,7 @@ Resources
365
365
366
366
# [Azure CLI](#tab/azure-cli)
367
367
368
-
```azurecli-interactive
368
+
```azurecli
369
369
az graph query -q "Resources | where type contains 'publicIPAddresses' and isnotempty(properties.ipAddress) | summarize count () by subscriptionId"
370
370
```
371
371
@@ -399,7 +399,7 @@ Resources
399
399
400
400
# [Azure CLI](#tab/azure-cli)
401
401
402
-
```azurecli-interactive
402
+
```azurecli
403
403
az graph query -q "Resources | where tags.environment=~'internal' | project name"
404
404
```
405
405
@@ -430,7 +430,7 @@ Resources
430
430
431
431
# [Azure CLI](#tab/azure-cli)
432
432
433
-
```azurecli-interactive
433
+
```azurecli
434
434
az graph query -q "Resources | where tags.environment=~'internal' | project name, tags"
435
435
```
436
436
@@ -464,7 +464,7 @@ Resources
464
464
465
465
# [Azure CLI](#tab/azure-cli)
466
466
467
-
```azurecli-interactive
467
+
```azurecli
468
468
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