Skip to content
Export guide · Cloud posture imports

How to export your Defender for Cloud findings, and what we import from them

In short

Defender for Cloud findings export: the file of open findings Defender for Cloud has already raised, which the review imports as they are, without connecting to Defender for Cloud.

How to export Defender for Cloud findings, step by step, what the review imports from the file, and what it does not read.

The fileJSON: one object with exported_at and a recommendations array (defender-for-cloud-recommendations.json), one row per assessment (a recommendation on one resource) as Azure Resource Graph returns it, with its state.
Highest grade its findings reachOBSERVED
Feeds attack pathsNo

Sources: Defender for Cloud documentation; the vendor table.

How to export it

Who can pull it
Security Reader on each subscription you want reviewed; Reader also works. Microsoft: "Security Reader: A user in this role has read-only access to Defender for Cloud. The user can view recommendations, alerts, security policies, and security states but can't make changes." It is needed because Azure Resource Graph returns rows for the resources you have at least read access to. A role given on a management group applies to the subscriptions inside it (Microsoft’s Azure role scope page). 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 for one tenant in Azure Cloud Shell; a Cloud Shell that has not been used before asks about storage and takes a minute or two more, and each extra 1,000 rows adds one quick query.
The file
JSON: one object with exported_at and a recommendations array (defender-for-cloud-recommendations.json), one row per assessment (a recommendation on one resource) as Azure Resource Graph returns it, with its state.

No console export: Microsoft documents the portal download as a comma-separated values (CSV) file (Microsoft Defender for Cloud → Recommendations → Download CSV report), which this importer does not read, so the export runs as a script in Azure Cloud Shell, inside the portal. The script adds Microsoft’s resource-graph extension to the Azure CLI in that shell; Cloud Shell already has the Azure CLI and jq.

From the command line

  1. Azure portal → the Cloud Shell button in the top navigation → Bash (if the Getting started pane appears, choose No storage account required, an ephemeral session, unless you already use Cloud Shell storage). Paste the script below, put the ID of the one subscription to review in place of <subscription id> on its second line (Azure portal → Subscriptions; the review keys each file on its subscription, so make one file per subscription), and press Enter. Its opening line adds Microsoft’s resource-graph extension to the Azure CLI in that shell. The script then asks Azure Resource Graph for every Defender for Cloud assessment (microsoft.security/assessments) in that subscription, each as Azure returns it (its id, name, type and properties, with the state in properties.status.code: Healthy, Unhealthy or NotApplicable): the review raises findings on the Unhealthy rows, and a row that was Unhealthy and is now Healthy shows the fix. Resource Graph returns up to 1,000 rows per query, so the script asks again with --skip-token for as long as the answer carries a skip_token, then merges the recommendations arrays into one file before you upload it, because a cut-off file under-reports. When it prints Done, choose Manage files → Download in the Cloud Shell toolbar and paste the path it printed:

    az extension add --name resource-graph --only-show-errors
    SUB="<subscription id>"
    Q="securityresources | where type == 'microsoft.security/assessments' | project id, name, type, properties"
    SKIP=""; : > dfc-pages.json
    while :; do
      if [ -z "$SKIP" ]; then az graph query --subscriptions "$SUB" --first 1000 -o json -q "$Q"; else az graph query --subscriptions "$SUB" --first 1000 -o json -q "$Q" --skip-token "$SKIP"; fi | tee dfc-page.json | jq '{exported_at: (now | todate), recommendations: .data}' >> dfc-pages.json
      SKIP=$(jq -r '.skip_token // empty' dfc-page.json); [ -z "$SKIP" ] && break
    done
    jq -s '{exported_at: (now | todate), recommendations: (map(.recommendations) | add // [])}' dfc-pages.json > defender-for-cloud-recommendations.json && echo "Done: $(jq '.recommendations | length' defender-for-cloud-recommendations.json) rows, $(jq '[.recommendations[] | select(.properties.status.code == "Unhealthy")] | length' defender-for-cloud-recommendations.json) of them Unhealthy, in $PWD/defender-for-cloud-recommendations.json"
    The vendor's page, checked 2026-10-19

What the file looks like

JSON: one object with exported_at and a recommendations array (defender-for-cloud-recommendations.json), one row per assessment (a recommendation on one resource) as Azure Resource Graph returns it, with its state.. It varies with the number of rows: each row carries Microsoft’s fix text. The upload limit is 25 MB.

A sample of the file, on a made-up system: cspm-defender-for-cloud.json.

Afterwards

Nothing to revoke: the script creates no key, token or account. After the download, run rm dfc-page.json dfc-pages.json defender-for-cloud-recommendations.json, and az extension remove --name resource-graph if you do not want the extension to stay. 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 the export goes wrong

What you seeThe fix
The script prints “Done: 0 rows”.Check the subscription ID on the second line of the script. Your account needs Security Reader or Reader on that subscription (Azure portal → Subscriptions → the subscription → Access control (IAM) → Check access → View my access). If it belongs to another Microsoft Entra directory, switch to it (portal → Settings → Directories + subscriptions → Switch), open a new Cloud Shell and run the script again.
The upload says “That file is not valid JSON.” or “The export did not parse as CSPM findings.”Upload defender-for-cloud-recommendations.json, at the path the script printed, not the portal’s CSV download or dfc-page.json.
On your own computer: “az: command not found”, “jq: command not found” or “Please run 'az login' to setup account.”Use Azure Cloud Shell, which has both tools and is already signed in; or install the Azure CLI and jq, run az login, then run the script again.

What we import from it

What is imported
The open findings Defender for Cloud already raised
The file
JSON: one object with exported_at and a recommendations array (defender-for-cloud-recommendations.json), one row per assessment (a recommendation on one resource) as Azure Resource Graph returns it, with its state.

The review imports each finding Defender for Cloud raised, with its resource and severity, and runs no check of its own on this file. So there is no Checks run figure for it: each finding is Defender for Cloud's, graded as read from its export.

The areas checked

  • Unhealthy recommendations: each recommendation’s name, ID and severity, the affected resource (its resource ID and name) and Microsoft’s fix text
  • Healthy and not-applicable rows: they raise nothing. A row that is now Healthy shows a fix since the last upload; a row that is now NotApplicable was not assessed, so the review cannot tell whether it was fixed

The grade its findings reach

Observed Findings from this file are OBSERVED: imported from Defender for Cloud’s own export, each with the resource it names.

Its findings stay in the review and its reports. Defender for Cloud 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

  • Regulatory compliance standards mapped to each recommendation, and the other members of properties: the file keeps them as Azure returns them, and the import does not read them
  • Security alerts and secure score: not in this export
  • Attack path analysis (Defender CSPM): not in this export

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 Defender for Cloud findings?

Security Reader on each subscription you want reviewed; Reader also works. Microsoft: "Security Reader: A user in this role has read-only access to Defender for Cloud. The user can view recommendations, alerts, security policies, and security states but can't make changes." It is needed because Azure Resource Graph returns rows for the resources you have at least read access to. A role given on a management group applies to the subscriptions inside it (Microsoft’s Azure role scope page). 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 Defender for Cloud or your subscriptions: the script sends read queries to Azure Resource Graph. Where it runs, it installs the resource-graph extension for the Azure CLI and writes three 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: the script keeps each assessment as Azure returns it (its id, name, type and properties). In clear text each row holds a recommendation, its state, its severity, Microsoft’s fix text and the full Azure resource ID it applies to, which contains the subscription ID, the resource group name and the resource name. Treat the file as sensitive: it lists where you are weak. The file itself is not stored: CyberTwin keeps just the findings read from it (each rule, its severity and the affected resource). Any token the command uses is never written into the file.