Azure resource graph query to get azure policies by category

MS Techie 2,716 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.
938 questions
{count} votes

1 answer

Sort by: Most helpful
  1. David Broggy 5,986 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


Your answer

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