Reputation: 359
I want to get the Azure Policy Compliance report for a particular resource and for a particular policy. How to achieve this using PowerShell? e.g. for a Azure VM and for a custom policy "Deny-Firewall".
Upvotes: 0
Views: 4013
Reputation: 23141
If you want to get the Azure Policy Compliance data with PowerShell, please refer to the following script
# get the policy compliance status
Get-AzPolicyState -PolicyDefinitionName <the policy definitionName>
# get the policy evaluation result
Get-AzPolicyEvent -PolicyDefinitionName <the policy definitionName>
2.1. Get data for a particular resource
# get the policy compliance status
Get-AzPolicyState -ResourceId <>
# get the policy evaluation result
Get-AzPolicyEvent -ResourceId <>
For more details, please refer to here
Upvotes: 0