@@ -41,7 +41,7 @@ Graph. Before running any of the following queries, check that your environment
41
41
PowerShell] ( ../first-query-powershell.md#add-the-resource-graph-module ) for steps to install and
42
42
validate your shell environment of choice.
43
43
44
- ## <a name =" count-resources " / >Count Azure resources
44
+ ## <a name =" count-resources " ></ a >Count Azure resources
45
45
46
46
This query returns number of Azure resources that exist in the subscriptions that you have access
47
47
to. It's also a good query to validate your shell of choice has the appropriate Azure Resource
@@ -74,7 +74,7 @@ Search-AzGraph -Query "Resources | summarize count()"
74
74
75
75
---
76
76
77
- ## <a name =" count-keyvaults " / >Count key vault resources
77
+ ## <a name =" count-keyvaults " ></ a >Count key vault resources
78
78
79
79
This query uses ` count ` instead of ` summarize ` to count the number of records returned. Only key
80
80
vaults are included in the count.
@@ -107,7 +107,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.keyvault/vaults' | c
107
107
108
108
---
109
109
110
- ## <a name =" list-resources " / >List resources sorted by name
110
+ ## <a name =" list-resources " ></ a >List resources sorted by name
111
111
112
112
This query returns any type of resource, but only the ** name** , ** type** , and ** location**
113
113
properties. It uses ` order by ` to sort the properties by the ** name** property in ascending (` asc ` )
@@ -141,7 +141,7 @@ Search-AzGraph -Query "Resources | project name, type, location | order by name
141
141
142
142
---
143
143
144
- ## <a name =" show-vms " / >Show all virtual machines ordered by name in descending order
144
+ ## <a name =" show-vms " ></ a >Show all virtual machines ordered by name in descending order
145
145
146
146
To list only virtual machines (which are type ` Microsoft.Compute/virtualMachines ` ), we can match
147
147
the property ** type** in the results. Similar to the previous query, ` desc ` changes the ` order by `
@@ -176,7 +176,7 @@ Search-AzGraph -Query "Resources | project name, location, type| where type =~ '
176
176
177
177
---
178
178
179
- ## <a name =" show-sorted " / >Show first five virtual machines by name and their OS type
179
+ ## <a name =" show-sorted " ></ a >Show first five virtual machines by name and their OS type
180
180
181
181
This query will use ` top ` to only retrieve five matching records that are ordered by name. The type
182
182
of the Azure resource is ` Microsoft.Compute/virtualMachines ` . ` project ` tells Azure Resource Graph
@@ -211,7 +211,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
211
211
212
212
---
213
213
214
- ## <a name =" count-os " / >Count virtual machines by OS type
214
+ ## <a name =" count-os " ></ a >Count virtual machines by OS type
215
215
216
216
Building on the previous query, we're still limiting by Azure resources of type
217
217
` Microsoft.Compute/virtualMachines ` , but are no longer limiting the number of records returned.
@@ -287,7 +287,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
287
287
> property is the incorrect case, a null or incorrect value is returned and the grouping or
288
288
> summarization would be incorrect.
289
289
290
- ## <a name =" show-storage " / >Show resources that contain storage
290
+ ## <a name =" show-storage " ></ a >Show resources that contain storage
291
291
292
292
Instead of explicitly defining the type to match, this example query will find any Azure resource
293
293
that ` contains ` the word ** storage** .
@@ -319,7 +319,7 @@ Search-AzGraph -Query "Resources | where type contains 'storage' | distinct type
319
319
320
320
---
321
321
322
- ## <a name =" list-publicip " / >List all public IP addresses
322
+ ## <a name =" list-publicip " ></ a >List all public IP addresses
323
323
324
324
Similar to the previous query, find everything that is a type with the word ** publicIPAddresses** .
325
325
This query expands on that pattern to only include results where ** properties.ipAddress**
@@ -355,7 +355,7 @@ Search-AzGraph -Query "Resources | where type contains 'publicIPAddresses' and i
355
355
356
356
---
357
357
358
- ## <a name =" count-resources-by-ip " / >Count resources that have IP addresses configured by subscription
358
+ ## <a name =" count-resources-by-ip " ></ a >Count resources that have IP addresses configured by subscription
359
359
360
360
Using the previous example query and adding ` summarize ` and ` count() ` , we can get a list by subscription of resources with configured IP addresses.
361
361
@@ -387,7 +387,7 @@ Search-AzGraph -Query "Resources | where type contains 'publicIPAddresses' and i
387
387
388
388
---
389
389
390
- ## <a name =" list-tag " / >List resources with a specific tag value
390
+ ## <a name =" list-tag " ></ a >List resources with a specific tag value
391
391
392
392
We can limit the results by properties other than the Azure resource type, such as a tag. In this
393
393
example, we're filtering for Azure resources with a tag name of ** Environment** that have a value
@@ -452,7 +452,7 @@ Search-AzGraph -Query "Resources | where tags.environment=~'internal' | project
452
452
453
453
---
454
454
455
- ## <a name =" list-specific-tag " / >List all storage accounts with specific tag value
455
+ ## <a name =" list-specific-tag " ></ a >List all storage accounts with specific tag value
456
456
457
457
Combine the filter functionality of the previous example and filter Azure resource type by ** type**
458
458
property. This query also limits our search for specific types of Azure resources with a specific
@@ -489,7 +489,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Storage/storageAccou
489
489
> [ !NOTE]
490
490
> This example uses ` == ` for matching instead of the ` =~ ` conditional. ` == ` is a case sensitive match.
491
491
492
- ## <a name =" show-aliases " / >Show aliases for a virtual machine resource
492
+ ## <a name =" show-aliases " ></ a >Show aliases for a virtual machine resource
493
493
494
494
[ Azure Policy aliases] ( ../../policy/concepts/definition-structure.md#aliases ) are used by Azure
495
495
Policy to manage resource compliance. Azure Resource Graph can return the _ aliases_ of a resource
@@ -526,7 +526,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
526
526
527
527
---
528
528
529
- ## <a name =" distinct-alias-values " / >Show distinct values for a specific alias
529
+ ## <a name =" distinct-alias-values " ></ a >Show distinct values for a specific alias
530
530
531
531
Seeing the value of aliases on a single resource is helpful, but it doesn't show the true value of
532
532
using Azure Resource Graph to query across subscriptions. This example looks at all values of a
@@ -561,7 +561,7 @@ Search-AzGraph -Query "Resources | where type=~'Microsoft.Compute/virtualMachine
561
561
562
562
---
563
563
564
- ## <a name =" unassociated-nsgs " / >Show unassociated network security groups
564
+ ## <a name =" unassociated-nsgs " ></ a >Show unassociated network security groups
565
565
566
566
This query returns Network Security Groups (NSGs) that aren't associated to a network interface or
567
567
subnet.
@@ -595,7 +595,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.network/networksecur
595
595
596
596
---
597
597
598
- ## <a name =" advisor-savings " / >Get cost savings summary from Azure Advisor
598
+ ## <a name =" advisor-savings " ></ a >Get cost savings summary from Azure Advisor
599
599
600
600
This query summarizes the cost savings of each
601
601
[ Azure Advisor] ( ../../../advisor/advisor-overview.md ) recommendation.
0 commit comments