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/advanced.md
+31-8Lines changed: 31 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
2
title: Advanced query samples
3
-
description: Use Azure Resource Graph to run some advanced queries, including VMSS capacity, listing all tags used, and matching virtual machines with regular expressions.
3
+
description: Use Azure Resource Graph to run some advanced queries, including virtual machine scale set capacity, listing all tags used, and matching virtual machines with regular expressions.
4
4
author: DCtheGeek
5
5
ms.author: dacoulte
6
-
ms.date: 01/23/2019
6
+
ms.date: 08/29/2019
7
7
ms.topic: quickstart
8
8
ms.service: resource-graph
9
9
manager: carmonm
@@ -23,7 +23,8 @@ We'll walk through the following advanced queries:
23
23
> -[List all tag names](#list-all-tags)
24
24
> -[Virtual machines matched by regex](#vm-regex)
25
25
26
-
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free) before you begin.
26
+
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free)
## <aname="vm-regex"></a>Virtual machines matched by regex
79
80
80
-
This query looks for virtual machines that match a [regular expression](/dotnet/standard/base-types/regular-expression-language-quick-reference) (known as _regex_).
81
-
The **matches regex \@** allows us to define the regex to match, which is `^Contoso(.*)[0-9]+$`. That regex definition is explained as:
81
+
This query looks for virtual machines that match a [regular expression](/dotnet/standard/base-types/regular-expression-language-quick-reference)
82
+
(known as _regex_). The **matches regex \@** allows us to define the regex to match, which is `^Contoso(.*)[0-9]+$`.
83
+
That regex definition is explained as:
82
84
83
85
-`^` - Match must start at the beginning of the string.
84
86
-`Contoso` - The case-sensitive string.
@@ -105,8 +107,29 @@ az graph query -q "where type =~ 'microsoft.compute/virtualmachines' and name ma
105
107
Search-AzGraph -Query "where type =~ 'microsoft.compute/virtualmachines' and name matches regex @'^Contoso(.*)[0-9]+$' | project name | order by name asc"
106
108
```
107
109
110
+
## <aname="displaynames"></a>Include the tenant and subscription names with DisplayNames
111
+
112
+
This query uses the new **Include** parameter with option _DisplayNames_ to add
113
+
**subscriptionDisplayName** and **tenantDisplayName** to the results. This parameter is only
114
+
available for Azure CLI and Azure PowerShell.
115
+
116
+
```azurecli-interactive
117
+
az graph query -q "limit 1" --include displayNames
0 commit comments