Share via

Azure resource graph query to get azure policies by category

MS Techie 2,761 Reputation points
2024-10-04T19:25:30.5966667+00:00

Azure resource graph query to get all azure policies by category (in an azure tenant )

Azure Policy
Azure Policy

An Azure service that is used to implement corporate governance and standards at scale for Azure resources.


1 answer

Sort by: Most helpful
  1. David Broggy 6,801 Reputation points MVP
    2024-10-04T20:07:35.6666667+00:00

    Hi MS Techie,

    Unfortunately I'm not aware of a way to use graph query to list Azure policies.

    Azure Resource Graph queries resources within the scope of your subscriptions and tenant. Built-in policies are defined at the Azure platform level and are not stored within individual subscriptions.

    You're probably going to need to use powershell commands like:

    az policy definition list --query "[].{name:name, displayName:displayName, category:metadata.category, policyType:policyType}" --output table

    az policy set-definition list --query "[?metadata.category=='Monitoring'].{name:name, displayName:displayName, category:metadata.category, policyType:policyType}" --output table

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.