Microsoft Defender Advanced Hunting (Event Hubs)
| SamurAI [Local] Collector | SamurAI [Cloud] Collector |
|---|---|
This guide describes the steps required to configure Microsoft Defender to send Advanced Hunting Logs to an Azure Event Hub for ingestion to Samurai via a local collector.
Ensure that a local collector has been deployed via the SamurAI Portal.
Ensure correct network connectivity
You must ensure the following connectivity requirements are fulfilled:
| Source | Destination | Ports | Description |
|---|---|---|---|
| Samurai Local Collector | Azure Event Hub resource | TCP/9093 | Log fetching |
Prerequisites
Before enabling Advanced Hunting streaming, make sure the prerequisites of the vendor documentation guide are fulfilled.
Stream Microsoft Defender XDR events to your Azure event hub: Prerequisites
- Create an Event Hubs namespace and take note of its Resource ID (Set up Event Hubs namespace).
- Create the Event Hub (see Create the Event Hub below).
Create the Event Hub
All Advanced Hunting tables must be streamed to one Event Hub, since a local collector integration reads a single Event Hub.
- In the Event Hubs namespace, select Event Hubs and then + Event Hub.
- Enter a name for the Event Hub. Take note of it.
- Set the partition count based on the expected load (a higher partition count allows more throughput).
- Open the new Event Hub, select Consumer groups and create a consumer group for the SamurAI collector. The
$Defaultgroup can be used if no other application reads this Event Hub. Take note of the name. - Select Shared access policies on the Event Hub and add a policy with the Listen claim for the SamurAI collector.
Event Hub capacity
The volume of Advanced Hunting events depends on the number of onboarded devices, enabled workloads and selected event types. Use the vendor’s Advanced Hunting query to estimate events per second and MB per second before choosing the throughput units and partitions.
Replace the line union withsource=MDTables MyDefenderTable part from the sample query with the following line:
union withsource=MDTables Device*Events,EmailEvents,EmailPostDeliveryEvents,EmailUrlInfo,UrlClickEvents,EmailAttachmentInfo
Collect the Event Hub details
Take note of the following information. It is used when setting up the integration on the local collector via the Samurai Portal.
- Event Hub name
- Consumer group
- Connection string: on the Event Hub, open Shared access policies, select the policy with the Listen claim and copy Connection string-primary key.
Enabling Defender Advanced Hunting Logs
Follow the vendor documentation guide to enable Advanced Hunting Logs data streaming to an Event Hub.
Stream Microsoft Defender XDR events to your Azure event hub
Ensure when configuring the Event Hub setting that Forward events to Azure Event Hub is selected and that it’s exporting to a single Event Hub, referencing the Event Hub name and the Event Hub namespace Resource ID of the namespace created above.
Recommended event types to stream for endpoint related data are:
- DeviceEvents
- DeviceFileEvents
- DeviceImageLoadEvents
- DeviceLogonEvents
- DeviceNetworkEvents
- DeviceProcessEvents
- DeviceRegistryEvents
- EmailAttachmentInfo
- EmailEvents
- EmailPostDeliveryEvents
- EmailUrlInfo
- UrlClickEvents
Exported messages can take up to one hour to appear in the Event Hub. To verify that events are flowing, check the Incoming Messages graph on the Event Hub Overview page in the Azure portal.
Complete the Azure Event Hubs Integration
Add the Azure Event Hubs integration to the local collector and enter the details noted earlier:
| Field | Value |
|---|---|
| Event Hub name | Name of the Event Hub that Defender streams to |
| Consumer group | The consumer group created for the collector (default $Default) |
| Event Hub connection string | Connection string of the shared access policy with the Listen claim |
Steps:
- Login to the SamurAI Portal
- Click Telemetry and select Integrations from the main menu
- Select Create
- Locate and click Azure Event Hubs
- Click Next and select the desired local collector
- Enter Event Hub name, Consumer group and Event Hub connection string as noted in Collect the Event Hub details
- Click Finish
Our Integration guide was accurate at the time of writing but vendors change things frequently! If you find errors or anything is outdated, let us know by raising a request in the SamurAI MDR Portal and we shall get it updated.