Skip to content

Commit b4e84ab

Browse files
Merge pull request #261587 from davidsmatlak/ds-arg-remove-anchors-20231219
Removes HTML heading anchors from ARG Starter samples docs
2 parents 85e3ad9 + 2315199 commit b4e84ab

File tree

7 files changed

+51
-50
lines changed

7 files changed

+51
-50
lines changed

articles/governance/includes/policy/policy-resources-exemption-query.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ PolicyResources
1616
| summarize count() by tostring(properties.policyAssignmentId)
1717
```
1818

19-
For more information about using scopes with Azure CLI or Azure PowerShell, go to [Count Azure resources](../../resource-graph/samples/starter.md#count-resources).
19+
For more information about using scopes with Azure CLI or Azure PowerShell, go to [Count Azure resources](../../resource-graph/samples/starter.md#count-azure-resources).
2020

2121
# [Azure CLI](#tab/azure-cli)
2222

articles/governance/resource-graph/concepts/query-language.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,23 +167,23 @@ Here's the list of KQL tabular operators supported by Resource Graph with specif
167167

168168
|KQL |Resource Graph sample query |Notes |
169169
|---|---|---|
170-
|[count](/azure/data-explorer/kusto/query/countoperator) |[Count key vaults](../samples/starter.md#count-keyvaults) | |
171-
|[distinct](/azure/data-explorer/kusto/query/distinctoperator) |[Show resources that contain storage](../samples/starter.md#show-storage) | |
172-
|[extend](/azure/data-explorer/kusto/query/extendoperator) |[Count virtual machines by OS type](../samples/starter.md#count-os) | |
170+
|[count](/azure/data-explorer/kusto/query/countoperator) |[Count key vaults](../samples/starter.md#count-key-vault-resources) | |
171+
|[distinct](/azure/data-explorer/kusto/query/distinctoperator) |[Show resources that contain storage](../samples/starter.md#show-resources-that-contain-storage) | |
172+
|[extend](/azure/data-explorer/kusto/query/extendoperator) |[Count virtual machines by OS type](../samples/starter.md#count-virtual-machines-by-os-type) | |
173173
|[join](/azure/data-explorer/kusto/query/joinoperator) |[Key vault with subscription name](../samples/advanced.md#key-vaults-with-subscription-name) |Join flavors supported: [innerunique](/azure/data-explorer/kusto/query/joinoperator#default-join-flavor), [inner](/azure/data-explorer/kusto/query/joinoperator#inner-join), [leftouter](/azure/data-explorer/kusto/query/joinoperator#left-outer-join). Limit of three `join` in a single query, one of which might be a cross-table `join`. If all cross-table `join` use is between _Resource_ and _ResourceContainers_, then three cross-table `join` are allowed. Custom join strategies, such as broadcast join, aren't allowed. For which tables can use `join`, go to [Resource Graph tables](#resource-graph-tables). |
174-
|[limit](/azure/data-explorer/kusto/query/limitoperator) |[List all public IP addresses](../samples/starter.md#list-publicip) |Synonym of `take`. Doesn't work with [Skip](./work-with-data.md#skipping-records). |
174+
|[limit](/azure/data-explorer/kusto/query/limitoperator) |[List all public IP addresses](../samples/starter.md#list-all-public-ip-addresses) |Synonym of `take`. Doesn't work with [Skip](./work-with-data.md#skipping-records). |
175175
|[mvexpand](/azure/data-explorer/kusto/query/mvexpandoperator) | | Legacy operator, use `mv-expand` instead. _RowLimit_ max of 400. The default is 128. |
176176
|[mv-expand](/azure/data-explorer/kusto/query/mvexpandoperator) |[List Azure Cosmos DB with specific write locations](../samples/advanced.md#list-azure-cosmos-db-with-specific-write-locations) |_RowLimit_ max of 400. The default is 128. Limit of 2 `mv-expand` in a single query.|
177-
|[order](/azure/data-explorer/kusto/query/orderoperator) |[List resources sorted by name](../samples/starter.md#list-resources) |Synonym of `sort` |
177+
|[order](/azure/data-explorer/kusto/query/orderoperator) |[List resources sorted by name](../samples/starter.md#list-resources-sorted-by-name) |Synonym of `sort` |
178178
|[parse](/azure/data-explorer/kusto/query/parseoperator) |[Get virtual networks and subnets of network interfaces](../samples/advanced.md#get-virtual-networks-and-subnets-of-network-interfaces) |It's optimal to access properties directly if they exist instead of using `parse`. |
179-
|[project](/azure/data-explorer/kusto/query/projectoperator) |[List resources sorted by name](../samples/starter.md#list-resources) | |
179+
|[project](/azure/data-explorer/kusto/query/projectoperator) |[List resources sorted by name](../samples/starter.md#list-resources-sorted-by-name) | |
180180
|[project-away](/azure/data-explorer/kusto/query/projectawayoperator) |[Remove columns from results](../samples/advanced.md#remove-columns-from-results) | |
181-
|[sort](/azure/data-explorer/kusto/query/sort-operator) |[List resources sorted by name](../samples/starter.md#list-resources) |Synonym of `order` |
182-
|[summarize](/azure/data-explorer/kusto/query/summarizeoperator) |[Count Azure resources](../samples/starter.md#count-resources) |Simplified first page only |
183-
|[take](/azure/data-explorer/kusto/query/takeoperator) |[List all public IP addresses](../samples/starter.md#list-publicip) |Synonym of `limit`. Doesn't work with [Skip](./work-with-data.md#skipping-records). |
184-
|[top](/azure/data-explorer/kusto/query/topoperator) |[Show first five virtual machines by name and their OS type](../samples/starter.md#show-sorted) | |
181+
|[sort](/azure/data-explorer/kusto/query/sort-operator) |[List resources sorted by name](../samples/starter.md#list-resources-sorted-by-name) |Synonym of `order` |
182+
|[summarize](/azure/data-explorer/kusto/query/summarizeoperator) |[Count Azure resources](../samples/starter.md#count-azure-resources) |Simplified first page only |
183+
|[take](/azure/data-explorer/kusto/query/takeoperator) |[List all public IP addresses](../samples/starter.md#list-all-public-ip-addresses) |Synonym of `limit`. Doesn't work with [Skip](./work-with-data.md#skipping-records). |
184+
|[top](/azure/data-explorer/kusto/query/topoperator) |[Show first five virtual machines by name and their OS type](../samples/starter.md#show-first-five-virtual-machines-by-name-and-their-os-type) | |
185185
|[union](/azure/data-explorer/kusto/query/unionoperator) |[Combine results from two queries into a single result](../samples/advanced.md#combine-results-from-two-queries-into-a-single-result) |Single table allowed: ```| union [kind= inner|outer] [withsource=ColumnName] Table```. Limit of three `union` legs in a single query. Fuzzy resolution of `union` leg tables isn't allowed. Might be used within a single table or between the _Resources_ and _ResourceContainers_ tables. |
186-
|[where](/azure/data-explorer/kusto/query/whereoperator) |[Show resources that contain storage](../samples/starter.md#show-storage) | |
186+
|[where](/azure/data-explorer/kusto/query/whereoperator) |[Show resources that contain storage](../samples/starter.md#show-resources-that-contain-storage) | |
187187

188188
There's a default limit of three `join` and three `mv-expand` operators in a single Resource Graph SDK query. You can request an increase in these limits for your tenant through **Help + support**.
189189

articles/governance/resource-graph/first-query-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ query. On the toolbar, click **Download as CSV** as shown in the following scree
8686
After running the previous query, if you select the **Charts** tab, you get a message that "the
8787
result set isn't compatible with a pie chart visualization." Queries that list results can't be made
8888
into a chart, but queries that provide counts of resources can. Using the
89-
[Sample query - Count virtual machines by OS type](./samples/starter.md#count-os), let's create a
89+
[Sample query - Count virtual machines by OS type](./samples/starter.md#count-virtual-machines-by-os-type), let's create a
9090
visualization from the Resource Graph query.
9191

9292
1. In the **Query 1** portion of the window, enter the following query and select **Run query**.

articles/governance/resource-graph/samples/starter.md

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ title: Starter query samples
33
description: Use Azure Resource Graph to run some starter queries, including counting resources, ordering resources, or by a specific tag.
44
author: davidsmatlak
55
ms.author: davidsmatlak
6-
ms.date: 08/31/2023
6+
ms.date: 12/19/2023
77
ms.topic: sample
88
ms.custom: devx-track-azurepowershell, devx-track-azurecli
99
---
10+
1011
# Starter Resource Graph query samples
1112

1213
The first step to understanding queries with Azure Resource Graph is a basic understanding of the
@@ -17,23 +18,23 @@ resources you're looking for.
1718

1819
This article uses the following starter queries:
1920

20-
- [Count Azure resources](#count-resources)
21-
- [Count Key Vault resources](#count-keyvaults)
22-
- [List resources sorted by name](#list-resources)
23-
- [Show all virtual machines ordered by name in descending order](#show-vms)
24-
- [Show first five virtual machines by name and their OS type](#show-sorted)
25-
- [Count virtual machines by OS type](#count-os)
26-
- [Show resources that contain storage](#show-storage)
27-
- [List all virtual network subnets](#list-subnets)
28-
- [List all public IP addresses](#list-publicip)
29-
- [Count resources that have IP addresses configured by subscription](#count-resources-by-ip)
30-
- [List resources with a specific tag value](#list-tag)
31-
- [List all storage accounts with specific tag value](#list-specific-tag)
32-
- [List all tags and their values](#list-all-tag-values)
33-
- [Show unassociated network security groups](#unassociated-nsgs)
34-
- [List alerts by severity](#list-azure-monitor-alerts-ordered-by-severity)
35-
- [List alerts by severity and resource type](#list-azure-monitor-alerts-ordered-by-severity-and-alert-state)
36-
- [List alerts by severity and resource type with a specific tag](#list-azure-monitor-alerts-ordered-by-severity-monitor-service-and-target-resource-type)
21+
- [Count Azure resources](#count-azure-resources)
22+
- [Count Key Vault resources](#count-key-vault-resources)
23+
- [List resources sorted by name](#list-resources-sorted-by-name)
24+
- [Show all virtual machines ordered by name in descending order](#show-all-virtual-machines-ordered-by-name-in-descending-order)
25+
- [Show first five virtual machines by name and their OS type](#show-first-five-virtual-machines-by-name-and-their-os-type)
26+
- [Count virtual machines by OS type](#count-virtual-machines-by-os-type)
27+
- [Show resources that contain storage](#show-resources-that-contain-storage)
28+
- [List all virtual network subnets](#list-all-azure-virtual-network-subnets)
29+
- [List all public IP addresses](#list-all-public-ip-addresses)
30+
- [Count resources that have IP addresses configured by subscription](#count-resources-that-have-ip-addresses-configured-by-subscription)
31+
- [List resources with a specific tag value](#list-resources-with-a-specific-tag-value)
32+
- [List all storage accounts with specific tag value](#list-all-storage-accounts-with-specific-tag-value)
33+
- [List all tags and their values](#list-all-tags-and-their-values)
34+
- [Show unassociated network security groups](#show-unassociated-network-security-groups)
35+
- [List Azure Monitor alerts ordered by severity](#list-azure-monitor-alerts-ordered-by-severity)
36+
- [List Azure Monitor alerts ordered by severity and alert state](#list-azure-monitor-alerts-ordered-by-severity-and-alert-state)
37+
- [List Azure Monitor alerts ordered by severity, monitor service, and target resource type](#list-azure-monitor-alerts-ordered-by-severity-monitor-service-and-target-resource-type)
3738

3839
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free)
3940
before you begin.
@@ -46,7 +47,7 @@ Graph. Before running any of the following queries, check that your environment
4647
PowerShell](../first-query-powershell.md#add-the-resource-graph-module) for steps to install and
4748
validate your shell environment of choice.
4849

49-
## <a name="count-resources"></a>Count Azure resources
50+
## Count Azure resources
5051

5152
This query returns number of Azure resources that exist in the subscriptions that you have access
5253
to. It's also a good query to validate your shell of choice has the appropriate Azure Resource
@@ -124,7 +125,7 @@ Search-AzGraph -Query "Resources | summarize count()" -UseTenantScope
124125

125126
---
126127

127-
## <a name="count-keyvaults"></a>Count Key Vault resources
128+
## Count Key Vault resources
128129

129130
This query uses `count` instead of `summarize` to count the number of records returned. Only key
130131
vaults are included in the count.
@@ -157,7 +158,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.keyvault/vaults' | c
157158

158159
---
159160

160-
## <a name="list-resources"></a>List resources sorted by name
161+
## List resources sorted by name
161162

162163
This query returns any type of resource, but only the **name**, **type**, and **location**
163164
properties. It uses `order by` to sort the properties by the **name** property in ascending (`asc`)
@@ -191,7 +192,7 @@ Search-AzGraph -Query "Resources | project name, type, location | order by name
191192

192193
---
193194

194-
## <a name="show-vms"></a>Show all virtual machines ordered by name in descending order
195+
## Show all virtual machines ordered by name in descending order
195196

196197
To list only virtual machines (which are type `Microsoft.Compute/virtualMachines`), we can match
197198
the property **type** in the results. Similar to the previous query, `desc` changes the `order by`
@@ -226,7 +227,7 @@ Search-AzGraph -Query "Resources | project name, location, type| where type =~ '
226227

227228
---
228229

229-
## <a name="show-sorted"></a>Show first five virtual machines by name and their OS type
230+
## Show first five virtual machines by name and their OS type
230231

231232
This query uses `top` to only retrieve five matching records that are ordered by name. The type
232233
of the Azure resource is `Microsoft.Compute/virtualMachines`. `project` tells Azure Resource Graph
@@ -261,7 +262,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
261262

262263
---
263264

264-
## <a name="count-os"></a>Count virtual machines by OS type
265+
## Count virtual machines by OS type
265266

266267
Building on the previous query, we're still limiting by Azure resources of type
267268
`Microsoft.Compute/virtualMachines`, but are no longer limiting the number of records returned.
@@ -337,7 +338,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
337338
> property is the incorrect case, a null or incorrect value is returned and the grouping or
338339
> summarization would be incorrect.
339340
340-
## <a name="show-storage"></a>Show resources that contain storage
341+
## Show resources that contain storage
341342

342343
Instead of explicitly defining the type to match, this example query finds any Azure resource
343344
that `contains` the word **storage**.
@@ -369,7 +370,7 @@ Search-AzGraph -Query "Resources | where type contains 'storage' | distinct type
369370

370371
---
371372

372-
## <a name="list-subnets"></a>List all Azure virtual network subnets
373+
## List all Azure virtual network subnets
373374

374375
This query returns a list of Azure virtual networks (VNets) including subnet names and address prefixes.
375376

@@ -403,12 +404,12 @@ Search-AzGraph -Query "Resources | where type == 'microsoft.network/virtualnetwo
403404

404405
---
405406

406-
## <a name="list-publicip"></a>List all public IP addresses
407+
## List all public IP addresses
407408

408409
Similar to the previous query, find everything that is a type with the word **publicIPAddresses**.
409410
This query expands on that pattern to only include results where **properties.ipAddress**
410411
`isnotempty`, to only return the **properties.ipAddress**, and to `limit` the results by the top
411-
100. You may need to escape the quotes depending on your chosen shell.
412+
100. You might need to escape the quotes depending on your chosen shell.
412413

413414
```kusto
414415
Resources
@@ -439,7 +440,7 @@ Search-AzGraph -Query "Resources | where type contains 'publicIPAddresses' and i
439440

440441
---
441442

442-
## <a name="count-resources-by-ip"></a>Count resources that have IP addresses configured by subscription
443+
## Count resources that have IP addresses configured by subscription
443444

444445
Using the previous example query and adding `summarize` and `count()`, we can get a list by subscription of resources with configured IP addresses.
445446

@@ -471,7 +472,7 @@ Search-AzGraph -Query "Resources | where type contains 'publicIPAddresses' and i
471472

472473
---
473474

474-
## <a name="list-tag"></a>List resources with a specific tag value
475+
## List resources with a specific tag value
475476

476477
We can limit the results by properties other than the Azure resource type, such as a tag. In this
477478
example, we're filtering for Azure resources with a tag name of **Environment** that have a value
@@ -536,7 +537,7 @@ Search-AzGraph -Query "Resources | where tags.environment=~'internal' | project
536537

537538
---
538539

539-
## <a name="list-specific-tag"></a>List all storage accounts with specific tag value
540+
## List all storage accounts with specific tag value
540541

541542
Combine the filter functionality of the previous example and filter Azure resource type by **type**
542543
property. This query also limits our search for specific types of Azure resources with a specific
@@ -573,7 +574,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Storage/storageAccou
573574
> [!NOTE]
574575
> This example uses `==` for matching instead of the `=~` conditional. `==` is a case sensitive match.
575576
576-
## <a name="list-all-tag-values"></a>List all tags and their values
577+
## List all tags and their values
577578

578579
This query lists tags on management groups, subscriptions, and resources along with their values.
579580
The query first limits to resources where tags `isnotempty()`, limits the included fields by only
@@ -623,7 +624,7 @@ Search-AzGraph -Query "ResourceContainers | where isnotempty(tags) | project tag
623624

624625
---
625626

626-
## <a name="unassociated-nsgs"></a>Show unassociated network security groups
627+
## Show unassociated network security groups
627628

628629
This query returns Network Security Groups (NSGs) that aren't associated to a network interface or
629630
subnet.

articles/governance/resource-graph/shared-query-bicep.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ If you don't have an Azure subscription, create a [free](https://azure.microsoft
2626

2727
## Review the Bicep file
2828

29-
In this quickstart, you create a shared query called _Count VMs by OS_. To try this query in SDK or in portal with Resource Graph Explorer, see [Samples - Count virtual machines by OS type](./samples/starter.md#count-os).
29+
In this quickstart, you create a shared query called _Count VMs by OS_. To try this query in SDK or in portal with Resource Graph Explorer, see [Samples - Count virtual machines by OS type](./samples/starter.md#count-virtual-machines-by-os-type).
3030

3131
The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/resourcegraph-sharedquery-countos/).
3232

articles/governance/resource-graph/shared-query-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ before you begin.
2929

3030
In this quickstart, you create a shared query called _Count VMs by OS_. To try this query in SDK or
3131
in portal with Resource Graph Explorer, see
32-
[Samples - Count virtual machines by OS type](./samples/starter.md#count-os).
32+
[Samples - Count virtual machines by OS type](./samples/starter.md#count-virtual-machines-by-os-type).
3333

3434
The template used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/resourcegraph-sharedquery-countos/).
3535

articles/governance/resource-graph/tutorials/create-share-query.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ follow these steps:
5252
Select **Run query** to see the query results in the bottom pane.
5353

5454
For more information about this query, see
55-
[Samples - Count virtual machines by OS type](../samples/starter.md#count-os).
55+
[Samples - Count virtual machines by OS type](../samples/starter.md#count-virtual-machines-by-os-type).
5656

5757
1. Select **Save** or **Save as**, enter **Count VMs by OS** as the name, leave the type as
5858
**Private query**, and then select **Save** at the bottom of the **Save query** pane. The tab
@@ -96,7 +96,7 @@ use it. To create a new Shared query, follow these steps:
9696
Select **Run query** to see the query results in the bottom pane.
9797

9898
For more information about this query, see
99-
[Samples - Count virtual machines by OS type](../samples/starter.md#count-os).
99+
[Samples - Count virtual machines by OS type](../samples/starter.md#count-virtual-machines-by-os-type).
100100

101101
1. Select **Save** or **Save as**.
102102

0 commit comments

Comments
 (0)