Export azure policies

vasudeva reddy 41 Reputation points
2020-07-27T09:31:26.927+00:00

HI Team,

I have a requirement to export all Azure policy definitions and policy assignments to a json file, later we want to automate all these from CI/CD pipelines.

Can you please help me on how to achieve this

Thanks
Vasudeva Reddy

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
793 questions
0 comments No comments
{count} votes

Accepted answer
  1. DCtheGeek-MSFT 451 Reputation points Microsoft Employee
    2020-07-27T14:28:35.973+00:00

    The SDK for Azure Policy supports this action.

    There are SDK for other languages also, such as REST API, .NET, JavaScript, and Python.

    All of the Azure CLI and Azure PowerShell operations and cmdlets can be run with no parameters to get all available objects (built-ins and custom for definitions) that the authenticated user has access to without any parameters.

    ![13936-image.png]

    Then you can loop through the results and convert them to JSON files:
    13905-image.png

    This approach also means you could filter the resulting definitions if you didn't want a specific category or something along those lines:
    13920-image.png

    2 people found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful