Microsoft Defender for Endpoint
Endpoint protection

Download assessment export files - Microsoft Defender for Endpoint | Microsoft Learn

In brief

A new page explains how to request assessment export URLs, check asynchronous Azure Blob copy status, and download every file in an assessment snapshot. It covers supported assessment endpoints, SAS URL handling, and required permissions and rate limits.

What Defender admins need to know

Administrators can use the guidance to automate exports and avoid downloading files before they are ready. SAS download URLs should be treated as credentials and protected from exposure.

Summaries are generated from the documentation change itself.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

new file mode 100644

layout: Conceptual title: Download assessment export files - Microsoft Defender for Endpoint | Microsoft Learn canonicalUrl: https://learn.microsoft.com/en-us/defender-endpoint/api/download-assessment-export-files breadcrumb_path: /defender-endpoint/breadcrumb/toc.json feedback_system: Standard permissioned-type: public feedback_product_url: https://techcommunity.microsoft.com/t5/security-compliance-and-identity/ct-p/MicrosoftSecurityandCompliance uhfHeaderId: MSDocsHeader-MicrosoftDefender manager: bagol description: Retrieve assessment export URLs, check asynchronous blob copy status, and download assessment files from Microsoft Defender for Endpoint APIs. ms.service: defender-endpoint ms.author: painbar author: paulinbar ms.localizationpriority: medium ms.collection:


Download assessment export files - Microsoft Defender for Endpoint | Microsoft Learn

Use the assessment export APIs to retrieve download URLs, then download the files from Azure Blob Storage. Each file contains part of the assessment snapshot. Download and process every file returned for that snapshot.

When an export file is prepared by an asynchronous Azure Blob Storage copy, the download URL can be available before the copy finishes. Check the destination blob's copy status before downloading it. You don't need to start a copy operation yourself.

Before you begin

Use the licensing requirements, permissions, parameters, and rate limits documented for the assessment method you call. Checking blob properties doesn't grant access to additional assessment data.

AssessmentFile export request
Secure configurationsGET /api/machines/SecureConfigurationsAssessmentExport
Software inventoryGET /api/machines/SoftwareInventoryExport
Non-product-code software inventoryGET /api/machines/SoftwareInventoryNonCpeExport
Software vulnerabilitiesGET /api/machines/SoftwareVulnerabilitiesExport

Request the export URLs

Call the file export method for the assessment you need. For example, request the software vulnerabilities export:

GET https://api.security.microsoft.com/api/machines/SoftwareVulnerabilitiesExport
Authorization: Bearer <access-token>

The response contains an exportFiles array of download URLs and a generatedTime value that identifies when the snapshot was generated. Use the complete URLs returned by the service rather than constructing storage account names or file paths.

The download URLs contain shared access signature (SAS) query parameters. Keep those parameters unchanged when checking copy status and downloading files. See the individual method reference for URL validity and the supported sasValidHours parameter.

Important

Treat download URLs as credentials. Don't expose their SAS tokens in logs, screenshots, or shared examples. Use each signed storage URL to access its blob; don't send your Defender API bearer token to Blob Storage.

Check whether each file is ready

For each URL in exportFiles, send a HEAD request to retrieve the destination blob's properties without downloading its content. Replace the placeholders below with the complete URL returned by the API, including its SAS query string.

HEAD https://<storage-account>.blob.core.windows.net/<container>/<blob>?<sas-token>

After a successful HEAD response, check the x-ms-copy-status header.

ValueMeaningAction
pendingThe copy is in progress.Wait, then repeat the HEAD request with backoff and a bounded retry period. Don't download yet.
successThe copy completed successfully.Proceed to download the file.
failedThe copy failed.Don't download. Check x-ms-copy-status-description for details and investigate the failure.
abortedThe copy was canceled.Don't download. Investigate before requesting another export.

A 200 OK response to HEAD doesn't, by itself, confirm that an asynchronous copy completed. For a blob being copied asynchronously, wait until x-ms-copy-status is success.

The header can be absent if the blob wasn't created by Copy Blob or was modified after a completed copy. Absence alone doesn't indicate success or failure. If you expect an asynchronously copied file but the header is missing or unrecognized, stop processing that file and investigate rather than assuming it is ready.

Azure Storage can return 202 Accepted when a Copy Blob operation starts. This acknowledges the copy request, not completion. It isn't the expected response to the HEAD request used here. For details, see Copy Blob and Get Blob Properties.

Download and process the files

After the copy succeeds, send a GET request to the same complete download URL.

GET https://<storage-account>.blob.core.windows.net/<container>/<blob>?<sas-token>
  1. Validate that the HTTP transfer completes before treating the file as downloaded. A successful copy doesn't guarantee that a later network transfer succeeds.
  2. Decompress the GZIP file and parse its multiline JSON content.
  3. Repeat the readiness check and download for every URL in the export response. Mark the snapshot complete only after every file is downloaded and processed successfully.

Handle retries and expired URLs

Use bounded retries with backoff for pending copies and transient request failures. Honor Retry-After when provided. Don't repeatedly call the export API to poll an existing blob's copy status; use HEAD on the returned URL instead.

  • If the polling deadline is reached while a copy is still pending, report the file as incomplete. Don't download it as though the copy succeeded.
  • If an HTTP request fails, handle the failure separately from the copy-status value. Don't treat an error response or missing response body as a completed file.
  • If a download is interrupted, retry that file while its URL is valid. Discard or isolate incomplete local downloads so they aren't processed as complete files.
  • If a URL expires, request fresh URLs through the assessment export API, subject to its rate limits. The new response can describe a newer snapshot; don't silently combine files from different snapshots.
  • For authorization failures, check the URL's expiry and preserve its complete SAS query string. Don't retry indefinitely or expose the token when reporting the error. \ No newline at end of file