Skip to content

Commit a03c6f5

Browse files
Merge pull request #201741 from timwarner-msft/timwarner-scopes
Add AuthorizationScopeFilter parameter to doc
2 parents e5ae6e1 + 5438e9e commit a03c6f5

File tree

6 files changed

+78
-20
lines changed

6 files changed

+78
-20
lines changed

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

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
title: Understand the query language
33
description: Describes Resource Graph tables and the available Kusto data types, operators, and functions usable with Azure Resource Graph.
4-
ms.date: 09/03/2021
4+
ms.date: 06/15/2022
55
ms.topic: conceptual
6+
ms.author: timwarner
7+
author: timwarner-msft
68
---
79
# Understanding the Azure Resource Graph query language
810

@@ -13,11 +15,16 @@ query language used by Resource Graph, start with the
1315

1416
This article covers the language components supported by Resource Graph:
1517

16-
- [Resource Graph tables](#resource-graph-tables)
17-
- [Resource Graph custom language elements](#resource-graph-custom-language-elements)
18-
- [Supported KQL language elements](#supported-kql-language-elements)
19-
- [Scope of the query](#query-scope)
20-
- [Escape characters](#escape-characters)
18+
- [Understanding the Azure Resource Graph query language](#understanding-the-azure-resource-graph-query-language)
19+
- [Resource Graph tables](#resource-graph-tables)
20+
- [Extended properties (preview)](#extended-properties-preview)
21+
- [Resource Graph custom language elements](#resource-graph-custom-language-elements)
22+
- [Shared query syntax (preview)](#shared-query-syntax-preview)
23+
- [Supported KQL language elements](#supported-kql-language-elements)
24+
- [Supported tabular/top level operators](#supported-tabulartop-level-operators)
25+
- [Query scope](#query-scope)
26+
- [Escape characters](#escape-characters)
27+
- [Next steps](#next-steps)
2128

2229
## Resource Graph tables
2330

@@ -89,7 +96,7 @@ Resources
8996
> When limiting the `join` results with `project`, the property used by `join` to relate the two
9097
> tables, _subscriptionId_ in the above example, must be included in `project`.
9198
92-
## <a name="extended-properties"></a>Extended properties (preview)
99+
## Extended properties (preview)
93100

94101
As a _preview_ feature, some of the resource types in Resource Graph have additional type-related
95102
properties available to query beyond the properties provided by Azure Resource Manager. This set of
@@ -114,7 +121,7 @@ Resources
114121

115122
## Resource Graph custom language elements
116123

117-
### <a name="shared-query-syntax"></a>Shared query syntax (preview)
124+
### Shared query syntax (preview)
118125

119126
As a preview feature, a [shared query](../tutorials/create-share-query.md) can be accessed directly
120127
in a Resource Graph query. This scenario makes it possible to create standard queries as shared
@@ -215,6 +222,51 @@ Group' with ID 'myMG'.
215222
}
216223
```
217224

225+
The `AuthorizationScopeFilter` parameter enables you to list Azure Policy assignments inherited from upper scopes. The `AuthorizationScopeFilter` parameter accepts the following values:
226+
227+
- **AtScopeAndBelow** (default if not specified): Returns policy assignments for the given scope and all child scopes
228+
- **AtScopeAndAbove**: Returns policy assignments for the given scope and all parent scopes, but not child scopes
229+
- **AtScopeAboveAndBelow**: Returns policy assignments for the given scope, all parent scopes and all child scopes
230+
- **AtScopeExact**: Returns policy assignments only for the given scope; no parent or child scopes are included
231+
232+
> [!NOTE]
233+
> To use the `AuthorizationScope` parameter, be sure to reference the **2021-06-01-preview** API version in your requests.
234+
235+
Example: Get all policy assignments at the **myMG** management group and Tenant Root (parent) scopes.
236+
237+
- REST API URI
238+
239+
```http
240+
POST https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-06-01-preview
241+
```
242+
243+
- Request Body Sample
244+
245+
```json
246+
{
247+
"authorizationScopeFilter": "AtScopeAndAbove",
248+
"query": "PolicyResources | where type =~ 'Microsoft.Authorization/PolicyAssignments'",
249+
"managementGroups": ["myMG"]
250+
}
251+
```
252+
253+
Example: Get all policy assignments at the **mySubscriptionId** subscription, management group, and Tenant Root scopes.
254+
255+
- REST API URI
256+
257+
```http
258+
POST https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-06-01-preview
259+
```
260+
- Request Body Sample
261+
262+
```json
263+
{
264+
"authorizationScopeFilter": "AtScopeAndAbove",
265+
"query": "PolicyResources | where type =~ 'Microsoft.Authorization/PolicyAssignments'",
266+
"subscriptions": ["mySubscriptionId"]
267+
}
268+
```
269+
218270
## Escape characters
219271

220272
Some property names, such as those that include a `.` or `$`, must be wrapped or escaped in the

articles/governance/resource-graph/overview.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
title: Overview of Azure Resource Graph
33
description: Understand how the Azure Resource Graph service enables complex querying of resources at scale across subscriptions and tenants.
4-
ms.date: 08/17/2021
4+
ms.date: 06/15/2022
55
ms.topic: overview
6+
ms.author: timwarner
7+
author: timwarner-msft
68
---
79
# What is Azure Resource Graph?
810

@@ -56,7 +58,7 @@ With Azure Resource Graph, you can:
5658
> [!NOTE]
5759
> As a _preview_ feature, some `type` objects have additional non-Resource Manager properties
5860
> available. For more information, see
59-
> [Extended properties (preview)](./concepts/query-language.md#extended-properties).
61+
> [Extended properties (preview)](./concepts/query-language.md#extended-properties-preview).
6062
6163
## How Resource Graph is kept current
6264

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
title: Advanced query samples
33
description: Use Azure Resource Graph to run some advanced queries, including working with columns, listing tags used, and matching resources with regular expressions.
4-
ms.date: 10/01/2021
4+
ms.date: 06/15/2022
55
ms.topic: sample
6+
ms.author: timwarner
7+
author: timwarner-msft
68
---
79
# Advanced Resource Graph query samples
810

@@ -601,7 +603,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.network/networkinter
601603

602604
## <a name="vm-powerstate"></a>Summarize virtual machine by the power states extended property
603605

604-
This query uses the [extended properties](../concepts/query-language.md#extended-properties) on
606+
This query uses the [extended properties](../concepts/query-language.md#extended-properties-preview) on
605607
virtual machines to summarize by power states.
606608

607609
```kusto

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
---
22
title: "Tutorial: Manage queries in the Azure portal"
33
description: In this tutorial, you create a Resource Graph Query and share the new query with others in the Azure portal.
4-
ms.date: 08/17/2021
4+
ms.date: 06/15/2022
55
ms.topic: tutorial
6+
ms.author: timwarner
7+
author: timwarner-msft
68
---
79
# Tutorial: Create and share an Azure Resource Graph query in the Azure portal
810

@@ -183,7 +185,7 @@ Resources
183185
## Run a shared query
184186

185187
A Resource Graph shared query can be run with the `{{shared-query-uri}}` syntax (preview). For more
186-
information, see [Shared query syntax](../concepts/query-language.md#shared-query-syntax).
188+
information, see [Shared query syntax](../concepts/query-language.md#shared-query-syntax-preview).
187189

188190
## Delete a Shared query
189191

includes/resource-graph/samples/bycat/azure-virtual-machines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
616616

617617
### Summarize virtual machine by the power states extended property
618618

619-
This query uses the [extended properties](../../../../articles/governance/resource-graph/concepts/query-language.md#extended-properties) on virtual machines to summarize by power states.
619+
This query uses the [extended properties](../../../../articles/governance/resource-graph/concepts/query-language.md#extended-properties-preview) on virtual machines to summarize by power states.
620620

621621
```kusto
622622
Resources

includes/resource-graph/samples/bytable/resources.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ Returns the connected cluster ID of each Azure Arc-enabled Kubernetes cluster th
454454

455455
```kusto
456456
Resources
457-
| where type =~ 'Microsoft.Kubernetes/connectedClusters' | extend connectedClusterId = tolower(id) | project connectedClusterId
457+
| where type =~ 'Microsoft.Kubernetes/connectedClusters' | extend connectedClusterId = tolower(id) | project connectedClusterId
458458
| join kind = leftouter
459459
(KubernetesConfigurationResources
460460
| where type == 'microsoft.kubernetesconfiguration/extensions'
@@ -573,7 +573,7 @@ Resources
573573
| join kind=leftouter(
574574
Resources
575575
| where type == 'microsoft.compute/virtualmachines/extensions'
576-
| extend
576+
| extend
577577
VMId = toupper(substring(id, 0, indexof(id, '/extensions'))),
578578
ExtensionName = name
579579
) on $left.JoinID == $right.VMId
@@ -825,7 +825,7 @@ Search-AzGraph -Query "ResourceContainers | where isnotempty(tags) | project tag
825825

826826
### List Arc-enabled servers not running latest released agent version
827827

828-
This query returns all Arc-enabled servers running an outdated version of the Connected Machine agent. Agents with a status of **Expired** are excluded from the results. The query uses _leftouter_ `join` to bring together the Advisor recommendations raised about any Connected Machine agents identified as out of date, and Hybrid Computer machines to filter out any agent that haven't communicated with Azure over a period of time.
828+
This query returns all Arc-enabled servers running an outdated version of the Connected Machine agent. Agents with a status of **Expired** are excluded from the results. The query uses _leftouter_ `join` to bring together the Advisor recommendations raised about any Connected Machine agents identified as out of date, and Hybrid Computer machines to filter out any agents that haven't communicated with Azure over a period of time.
829829

830830
```kusto
831831
AdvisorResources
@@ -992,7 +992,7 @@ Search-AzGraph -Query "Resources | where type in ( 'microsoft.managedidentity/us
992992

993993
### List machines that are not running and the last compliance status
994994

995-
Provides a list of a machines that aren't powered on with their configuration assignments and the last reported compliance status.
995+
Provides a list of machines that aren't powered on with their configuration assignments and the last reported compliance status.
996996

997997
```kusto
998998
Resources
@@ -1417,7 +1417,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.network/networksecur
14171417

14181418
### Summarize virtual machine by the power states extended property
14191419

1420-
This query uses the [extended properties](../../../../articles/governance/resource-graph/concepts/query-language.md#extended-properties) on virtual machines to summarize by power states.
1420+
This query uses the [extended properties](../../../../articles/governance/resource-graph/concepts/query-language.md#extended-properties-preview) on virtual machines to summarize by power states.
14211421

14221422
```kusto
14231423
Resources

0 commit comments

Comments
 (0)