Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
| Assessment | File export request |
|---|---|
| Secure configurations | GET /api/machines/SecureConfigurationsAssessmentExport |
| Software inventory | GET /api/machines/SoftwareInventoryExport |
| Non-product-code software inventory | GET /api/machines/SoftwareInventoryNonCpeExport |
| Software vulnerabilities | GET /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.
| Value | Meaning | Action |
|---|---|---|
pending |
The copy is in progress. | Wait, then repeat the HEAD request with backoff and a bounded retry period. Don't download yet. |
success |
The copy completed successfully. | Proceed to download the file. |
failed |
The copy failed. | Don't download. Check x-ms-copy-status-description for details and investigate the failure. |
aborted |
The 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>
- Validate that the HTTP transfer completes before treating the file as downloaded. A successful copy doesn't guarantee that a later network transfer succeeds.
- Decompress the GZIP file and parse its multiline JSON content.
- 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.