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
As a preview feature, a [shared query](../tutorials/create-share-query.md) can be accessed directly
120
127
in a Resource Graph query. This scenario makes it possible to create standard queries as shared
@@ -215,6 +222,51 @@ Group' with ID 'myMG'.
215
222
}
216
223
```
217
224
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
+
218
270
## Escape characters
219
271
220
272
Some property names, such as those that include a `.` or `$`, must be wrapped or escaped in the
Copy file name to clipboardExpand all lines: articles/governance/resource-graph/samples/advanced.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,10 @@
1
1
---
2
2
title: Advanced query samples
3
3
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
5
5
ms.topic: sample
6
+
ms.author: timwarner
7
+
author: timwarner-msft
6
8
---
7
9
# Advanced Resource Graph query samples
8
10
@@ -601,7 +603,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.network/networkinter
601
603
602
604
## <aname="vm-powerstate"></a>Summarize virtual machine by the power states extended property
603
605
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
Copy file name to clipboardExpand all lines: includes/resource-graph/samples/bycat/azure-virtual-machines.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -616,7 +616,7 @@ Search-AzGraph -Query "Resources | where type =~ 'Microsoft.Compute/virtualMachi
616
616
617
617
### Summarize virtual machine by the power states extended property
618
618
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.
@@ -825,7 +825,7 @@ Search-AzGraph -Query "ResourceContainers | where isnotempty(tags) | project tag
825
825
826
826
### List Arc-enabled servers not running latest released agent version
827
827
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.
829
829
830
830
```kusto
831
831
AdvisorResources
@@ -992,7 +992,7 @@ Search-AzGraph -Query "Resources | where type in ( 'microsoft.managedidentity/us
992
992
993
993
### List machines that are not running and the last compliance status
994
994
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.
996
996
997
997
```kusto
998
998
Resources
@@ -1417,7 +1417,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.network/networksecur
1417
1417
1418
1418
### Summarize virtual machine by the power states extended property
1419
1419
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.
0 commit comments