In short
Azure Policy configuration export: the file Azure Policy writes of its own settings, which a configuration review reads setting by setting without connecting to Azure Policy.
How to export the Azure Policy configuration, step by step, what the review checks in the file (4 checks run), and what it does not read.
| The file | JSON, one file per subscription (azure-policy.json) with two lists: policyAssignments and policyExemptions |
|---|---|
| Checks run on it | 4 |
| Highest grade its findings reach | PROVEN |
| Feeds attack paths | No |
| Not read from this export | 2 areas, listed below |
Sources: Azure Policy documentation (1); Azure Policy documentation (2); Azure Policy documentation (3); the vendor table.
How to export it
- Who can pull it
- The Azure built-in role Reader on the subscription. Microsoft describes it as "View all resources, but does not allow you to make any changes", and its one action is */read. It is needed because the list commands read policy assignments and exemptions, and Microsoft says "Both Contributor and Reader have access to all read Azure Policy operations". Azure Cloud Shell needs the Microsoft.CloudShell resource provider registered on the subscription, once; a Reader cannot register it, so if Cloud Shell will not start, ask a subscription Owner or Contributor to register it (Subscriptions → the subscription → Resource providers → Microsoft.CloudShell → Register), or run the commands with the Azure CLI on your own computer.
- Time
- About 5 minutes per subscription.
- The file
- JSON, one file per subscription (azure-policy.json) with two lists: policyAssignments and policyExemptions
No console export: Microsoft says Azure Policy resources "can be exported through REST API, Azure CLI, and Azure PowerShell". In the Azure portal it names a download of Azure Resource Graph query results as comma-separated values (CSV), which the review does not read. So use the commands: Azure Cloud Shell runs them inside the portal and already has the Azure CLI and jq.
From the command line
The vendor's page, checked 2026-11-11az account set --subscription <subscription-id>(the subscription to review, by name or ID; runaz account list -o tableto list the subscriptions you can use)
The vendor's page, checked 2026-11-11az policy assignment list --disable-scope-strict-match -o json > assignments.json
The vendor's page, checked 2026-11-11az policy exemption list --disable-scope-strict-match -o json > exemptions.json
The vendor's page, checked 2026-11-11az policy assignment list --filter "atScope()" -o json > assignments-applied.json
The vendor's page, checked 2026-11-11az policy exemption list --filter "atScope()" -o json > exemptions-applied.json
The vendor's page, checked 2026-11-11jq -n --slurpfile a assignments-applied.json --slurpfile b assignments.json --slurpfile e exemptions-applied.json --slurpfile f exemptions.json '{policyAssignments: ($a[0] + $b[0] | unique_by(.id)), policyExemptions: ($e[0] + $f[0] | unique_by(.id))}' > azure-policy.jsonIn Cloud Shell, choose Manage files > Download and enter the full path of azure-policy.json (run realpath azure-policy.json to print it); on your own computer the file is already in the folder you ran the commands in
The vendor's page, checked 2026-11-11
What the file looks like
JSON, one file per subscription (azure-policy.json) with two lists: policyAssignments and policyExemptions. It varies with the number of assignments and exemptions and with how many parameters each assignment sets. The upload takes files up to 10 MB.
What it holds: Every Azure Policy assignment and exemption that applies to the subscription, which Microsoft documents as including those from the management groups that contain it (the atScope() lists), plus those set on the scopes inside the subscription (the --disable-scope-strict-match lists): scope, enforcement mode, parameters, category, expiry and description, in one azure-policy.json.
Run the steps once per subscription. Two lists are joined because Microsoft documents them differently: --filter "atScope()" returns what applies to the subscription, including what comes from the management groups that contain it, and --disable-scope-strict-match is described as "Include policy assignments either inherited from parent scopes or at child scopes" (the Azure CLI sends the filter atScopeAndBelow() for it). Run these commands in bash (macOS, Linux, WSL, or Bash in Azure Cloud Shell): in Windows PowerShell 5.1, > writes UTF-16, which jq and the upload refuse.
Afterwards
Nothing to revoke: the steps create no key, token or account. After the download, run rm assignments*.json exemptions*.json azure-policy.json and close Cloud Shell; a session started with No storage account required deletes its files when it ends. On your own computer run az logout. If you mounted storage for this, its storage account stays and is billed until you delete it.
If the export goes wrong
| What you see | The fix |
|---|---|
| When it starts, Cloud Shell asks you to choose storage, and you cannot create a storage account (Microsoft: "users must have contributor access or higher at the storage account level") | In the Getting started pane choose No storage account required (an ephemeral session), and download azure-policy.json before you close Cloud Shell, because an ephemeral session deletes its files. |
| A list command stops with the error code AuthorizationFailed: your account "does not have authorization to perform action" on the policy assignments or exemptions of that subscription | Run az account set with the subscription you hold Reader on, or ask an administrator who can assign roles to give you Reader on it (Azure portal → Subscriptions → the subscription → Access control (IAM) → Add → Add role assignment). Microsoft says a new role can take up to 10 minutes; signing out and in again refreshes it. |
| The upload says "Invalid JSON" or that the file does not match any expected format | Upload azure-policy.json, the file the jq step writes (not assignments.json), written in Bash, not Windows PowerShell 5.1, which writes the file as UTF-16. |
What we read from it
- Checks run
- 4
- Formats read
- Policy assignments + Defender secure score JSON
- Releases
- 2024.1 to current
Checks run is the number of checks that reached a result on this system's own export in our tests, as the vendor table shows it.
The areas checked
- Policy assignments: enforcement mode (DoNotEnforce), audit-only effects on baseline policies, and management-group scope
- Policy exemptions: expiry dates and waiver reasons
The grade its findings reach
Proven A finding from this file can reach PROVEN: the stored file is read a second time by a separate reader, and the finding is found at the setting it names.
Its findings stay in the review and its reports. Azure Policy does not feed attack paths.
Attack paths, the one change and dollar figures are MODELED. How each grade is worked out is on the method page.
What we do not read from this export
- Network security group (NSG) rules and NSG flow logs
- Storage account and Key Vault firewalls and network rules
- Role assignments and PIM: who holds Owner or Contributor
- Which resources pass or fail each policy (compliance results)
- The logic inside custom policy definitions and initiatives
Limits of the reader
- Findings stay in the review. They do not feed attack paths.
- The checks of this system are not counted: a check counts once a test shows it firing on a file in the layout the vendor documents.
A finding never comes from what the file does not hold: live traffic, running hosts and logs are not in a configuration export.
Questions
Who can export the Azure Policy configuration?
The Azure built-in role Reader on the subscription. Microsoft describes it as "View all resources, but does not allow you to make any changes", and its one action is */read. It is needed because the list commands read policy assignments and exemptions, and Microsoft says "Both Contributor and Reader have access to all read Azure Policy operations". Azure Cloud Shell needs the Microsoft.CloudShell resource provider registered on the subscription, once; a Reader cannot register it, so if Cloud Shell will not start, ask a subscription Owner or Contributor to register it (Subscriptions → the subscription → Resource providers → Microsoft.CloudShell → Register), or run the commands with the Azure CLI on your own computer.
Does the export change anything?
Nothing in the subscription: the list commands are GET (read) requests and Reader has no write action. Locally, az account set changes the active subscription in your Azure CLI profile and the steps write five files. In Cloud Shell, choosing Mount storage account creates a billed resource group and storage account.
Does the file hold passwords or keys?
No password, key or token field. In clear text it holds subscription, management group and resource IDs, the values set for each assignment’s parameters, who made each assignment (metadata.assignedBy and createdBy) and each exemption’s description and metadata, which Microsoft’s example fills with who requested and approved it and a ticket reference. With redaction on (the default), the passwords, keys and tokens the review recognises are replaced with a placeholder before anything is stored; the check before upload shows how many it found.