Skip to content

Commit 6c9520c

Browse files
authored
Update Non compliance example
Updated non compliance example to be more useful by showing actual non compliant resource ID and the policy assignment name that it is non compliant for
1 parent 62e702a commit 6c9520c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

includes/resource-graph/samples/bycat/azure-policy.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,16 @@ Search-AzGraph -Query "PolicyResources | where type =~ 'Microsoft.PolicyInsights
123123
Provides a list of all resources types that are in a `NonCompliant` state.
124124

125125
```kusto
126-
PolicyResources
126+
"PolicyResources
127127
| where type == 'microsoft.policyinsights/policystates'
128128
| where properties.complianceState == 'NonCompliant'
129+
| extend NonCompliantResourceId = properties.resourceId, PolicyAssignmentName = properties.policyAssignmentName"
129130
```
130131

131132
# [Azure CLI](#tab/azure-cli)
132133

133134
```azurecli-interactive
134-
az graph query -q "PolicyResources | where type == 'microsoft.policyinsights/policystates' | where properties.complianceState == 'NonCompliant'"
135+
az graph query -q "PolicyResources | where type == 'microsoft.policyinsights/policystates' | where properties.complianceState == 'NonCompliant' | extend NonCompliantResourceId = properties.resourceId, PolicyAssignmentName = properties.policyAssignmentName"
135136
```
136137

137138
# [Azure PowerShell](#tab/azure-powershell)

0 commit comments

Comments
 (0)