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/samples/starter.md
+39-2Lines changed: 39 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,17 @@
1
1
---
2
2
title: Starter query samples
3
3
description: Use Azure Resource Graph to run some starter queries, including counting resources, ordering resources, or by a specific tag.
4
-
ms.date: 07/07/2021
4
+
author: timwarner-msft
5
+
ms.author: timwarner
6
+
ms.date: 07/19/2022
5
7
ms.topic: sample
6
8
---
7
9
# Starter Resource Graph query samples
8
10
9
11
The first step to understanding queries with Azure Resource Graph is a basic understanding of the
10
12
[Query Language](../concepts/query-language.md). If you aren't already familiar with
11
13
[Kusto Query Language (KQL)](/azure/kusto/query/index), it's recommended to review the
12
-
[tutorial for KQL](/azure/kusto/query/tutorial) to understand how to compose requests for the
14
+
[KQL tutorial](/azure/kusto/query/tutorial) to understand how to compose requests for the
13
15
resources you're looking for.
14
16
15
17
We'll walk through the following starter queries:
@@ -21,6 +23,7 @@ We'll walk through the following starter queries:
21
23
-[Show first five virtual machines by name and their OS type](#show-sorted)
22
24
-[Count virtual machines by OS type](#count-os)
23
25
-[Show resources that contain storage](#show-storage)
26
+
-[List all virtual network subnets](#list-subnets)
24
27
-[List all public IP addresses](#list-publicip)
25
28
-[Count resources that have IP addresses configured by subscription](#count-resources-by-ip)
26
29
-[List resources with a specific tag value](#list-tag)
@@ -317,6 +320,40 @@ Search-AzGraph -Query "Resources | where type contains 'storage' | distinct type
317
320
318
321
---
319
322
323
+
## <aname="list-subnets"></a>List all Azure virtual network subnets
324
+
325
+
This query returns a list of Azure virtual networks (VNets) including subnet names and address prefixes. Thanks to [Saul Dolgin](https://github.com/sdolgin) for the contribution.
326
+
327
+
```kusto
328
+
Resources
329
+
| where type == 'microsoft.network/virtualnetworks'
- Azure Government portal: <ahref="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/Resources%0A%7C%20where%20type%20%3D%3D%20%27microsoft.network%2Fvirtualnetworks%27%0A%7C%20extend%20subnets%20%3D%20properties.subnets%0A%7C%20mv-expand%20subnets%0A%7C%20project%20name%2C%20subnets.name%2C%20subnets.properties.addressPrefix%2C%20location%2C%20resourceGroup%2C%20subscriptionId"target="_blank">portal.Azure.us</a>
353
+
- Azure China 21Vianet portal: <ahref="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/Resources%0A%7C%20where%20type%20%3D%3D%20%27microsoft.network%2Fvirtualnetworks%27%0A%7C%20extend%20subnets%20%3D%20properties.subnets%0A%7C%20mv-expand%20subnets%0A%7C%20project%20name%2C%20subnets.name%2C%20subnets.properties.addressPrefix%2C%20location%2C%20resourceGroup%2C%20subscriptionId"target="_blank">portal.Azure.cn</a>
354
+
355
+
---
356
+
320
357
## <aname="list-publicip"></a>List all public IP addresses
321
358
322
359
Similar to the previous query, find everything that is a type with the word **publicIPAddresses**.
0 commit comments