Continuously export Microsoft Defender for Cloud data

Microsoft Defender for Cloud generates detailed security alerts and recommendations. To analyze the information in these alerts and recommendations, you can export them to Azure Log Analytics, Event Hubs, or to another SIEM, SOAR, or IT classic deployment model solution. You can stream the alerts and recommendations as they're generated or define a schedule to send periodic snapshots of all of the new data.

With continuous export, you can fully customize what information to export and where it goes. For example, you can configure it so that:

  • All high severity alerts are sent to an Azure event hub
  • All medium or higher severity findings from vulnerability assessment scans of your SQL servers are sent to a specific Log Analytics workspace
  • Specific recommendations are delivered to an event hub or Log Analytics workspace whenever they're generated
  • The secure score for a subscription is sent to a Log Analytics workspace whenever the score for a control changes by 0.01 or more

This article describes how to configure continuous export to Log Analytics workspaces or Azure event hubs.

Tip

Defender for Cloud also offers the option to perform a one-time, manual export to CSV. Learn more in Manual one-time export of alerts and recommendations.

Availability

Aspect Details
Release state: General availability (GA)
Pricing: Free
Required roles and permissions:
  • Security admin or Owner on the resource group
  • Write permissions for the target resource.
  • If you're using the Azure Policy 'DeployIfNotExist' policies, you need the permissions that allow you to assign policies
  • To export data to Event Hubs, you need Write permission on the Event Hubs Policy.
  • To export to a Log Analytics workspace:
    • if it has the SecurityCenterFree solution, you need a minimum of read permissions for the workspace solution: Microsoft.OperationsManagement/solutions/read
    • if it doesn't have the SecurityCenterFree solution, you need write permissions for the workspace solution: Microsoft.OperationsManagement/solutions/action
    • Learn more about Azure Monitor and Log Analytics workspace solutions
Clouds: Commercial clouds
National (Azure Government, Microsoft Azure operated by 21Vianet)

What data types can be exported?

Continuous export can export the following data types whenever they change:

Set up a continuous export

You can configure continuous export from the Microsoft Defender for Cloud pages in Azure portal, via the REST API, or at scale using the supplied Azure Policy templates.

Configure continuous export from the Defender for Cloud pages in Azure portal

If you're setting up a continuous export to Log Analytics or Azure Event Hubs:

  1. From Defender for Cloud's menu, open Environment settings.

  2. Select the specific subscription for which you want to configure the data export.

  3. From the sidebar of the settings page for that subscription, select Continuous export.

    Export options in Microsoft Defender for Cloud.

    Here you see the export options. There's a tab for each available export target, either event hub or Log Analytics workspace.

  4. Select the data type you'd like to export and choose from the filters on each type (for example, export only high severity alerts).

  5. Select the export frequency:

    • Streaming – assessments are sent when a resource’s health state is updated (if no updates occur, no data is sent).
    • Snapshots – a snapshot of the current state of the selected data types that are sent once a week per subscription. To identify snapshot data, look for the field IsSnapshot.

    If your selection includes one of these recommendations, you can include the vulnerability assessment findings together with them:

    To include the findings with these recommendations, enable the include security findings option.

    Include security findings toggle in continuous export configuration.

  6. From the "Export target" area, choose where you'd like the data saved. Data can be saved in a target of a different subscription (for example, on a Central Event Hubs instance or a central Log Analytics workspace).

    You can also send the data to an Event hubs or Log Analytics workspace in a different tenant.

  7. Select Save.

Note

Log analytics supports records that are only up to 32KB in size. When the data limit is reached, you will see an alert telling you that the Data limit has been exceeded.

Exporting to a Log Analytics workspace

If you want to analyze Microsoft Defender for Cloud data inside a Log Analytics workspace or use Azure alerts together with Defender for Cloud alerts, set up continuous export to your Log Analytics workspace.

Log Analytics tables and schemas

Security alerts and recommendations are stored in the SecurityAlert and SecurityRecommendation tables respectively.

The name of the Log Analytics solution containing these tables depends on whether you've enabled the enhanced security features: Security ('Security and Audit') or SecurityCenterFree.

Tip

To see the data on the destination workspace, you must enable one of these solutions Security and Audit or SecurityCenterFree.

The SecurityAlert table in Log Analytics.

To view the event schemas of the exported data types, visit the Log Analytics table schemas.

Export data to an Azure Event Hubs or Log Analytics workspace in another tenant

You cannot configure data to be exported to a log analytics workspace in another tenant when using Azure Policy to assign the configuration. This process only works with the REST API, and the configuration is unsupported in the Azure portal (due to requiring multitenant context). Azure Lighthouse does not resolve this issue with Policy, although you can use Lighthouse as the authentication method.

When collecting data into a tenant, you can analyze the data from one central location.

To export data to an Azure Event Hubs or Log Analytics workspace in a different tenant:

  1. In the tenant that has the Azure Event Hubs or Log Analytics workspace, invite a user from the tenant that hosts the continuous export configuration, or alternatively configure Azure Lighthouse for the source and destination tenant.
  2. If using Azure AD B2B Guest access, ensure that the user accepts the invitation to access the tenant as a guest.
  3. If you're using a Log Analytics Workspace, assign the user in the workspace tenant one of these roles: Owner, Contributor, Log Analytics Contributor, Sentinel Contributor, or Monitoring Contributor.
  4. Create and submit the request to the Azure REST API to configure the required resources. You'll need to manage the bearer tokens in both the context of the local (workspace) and the remote (continuous export) tenant.

Continuously export to an event hub behind a firewall

You can enable continuous export as a trusted service, so that you can send data to an event hub that has an Azure Firewall enabled.

To grant access to continuous export as a trusted service:

  1. Sign in to the Azure portal.

  2. Navigate to Microsoft Defender for Cloud > Environmental settings.

  3. Select the relevant resource.

  4. Select Continuous export.

  5. Select Export as a trusted service.

    Screenshot that shows where the checkbox is located to select export as trusted service.

You need to add the relevant role assignment on the destination Event Hubs.

To add the relevant role assignment on the destination Event Hub:

  1. Navigate to the selected Event Hubs.

  2. Select Access Control > Add role assignment

    Screenshot that shows where the add role assignment button is found.

  3. Select Azure Event Hubs Data Sender.

  4. Select the Members tab.

  5. Select + Select members.

  6. Search for and select Windows Azure Security Resource Provider.

    Screenshot that shows you where to enter and search for Microsoft Azure Security Resource Provider.

  7. Select Review + assign.

View exported alerts and recommendations in Azure Monitor

You might also choose to view exported Security Alerts and/or recommendations in Azure Monitor.

Azure Monitor provides a unified alerting experience for various Azure alerts including Diagnostic Log, Metric alerts, and custom alerts based on Log Analytics workspace queries.

To view alerts and recommendations from Defender for Cloud in Azure Monitor, configure an Alert rule based on Log Analytics queries (Log Alert):

  1. From Azure Monitor's Alerts page, select New alert rule.

    Azure Monitor's alerts page.

  2. In the create rule page, configure your new rule (in the same way you'd configure a log alert rule in Azure Monitor):

    • For Resource, select the Log Analytics workspace to which you exported security alerts and recommendations.

    • For Condition, select Custom log search. In the page that appears, configure the query, lookback period, and frequency period. In the search query, you can type SecurityAlert or SecurityRecommendation to query the data types that Defender for Cloud continuously exports to as you enable the Continuous export to Log Analytics feature.

    • Optionally, configure the Action Group that you'd like to trigger. Action groups can trigger email sending, ITSM tickets, WebHooks, and more. Azure Monitor alert rule.

The Microsoft Defender for Cloud alerts or recommendations appears (depending on your configured continuous export rules and the condition you defined in your Azure Monitor alert rule) in Azure Monitor alerts, with automatic triggering of an action group (if provided).

Manual one-time export of alerts and recommendations

To download a CSV report for alerts or recommendations, open the Security alerts or Recommendations page and select the Download CSV report button.

Tip

Due to Azure Resource Graph limitations, the reports are limited to a file size of 13K rows. If you're seeing errors related to too much data being exported, try limiting the output by selecting a smaller set of subscriptions to be exported.

Download alerts data as a CSV file.

Note

These reports contain alerts and recommendations for resources from the currently selected subscriptions.

Next steps

In this article, you learned how to configure continuous exports of your recommendations and alerts. You also learned how to download your alerts data as a CSV file.

For related material, see the following documentation: