Microsoft Defender Advanced Hunting (Event Hubs)

SamurAI [Local] CollectorSamurAI [Cloud] Collector
Picture1.svg

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:

SourceDestinationPortsDescription
Samurai Local CollectorAzure Event Hub resourceTCP/9093Log fetching

Prerequisites

Before enabling Advanced Hunting streaming, make sure the prerequisites of the vendor documentation guide are fulfilled.

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.

  1. In the Event Hubs namespace, select Event Hubs and then + Event Hub.
  2. Enter a name for the Event Hub. Take note of it.
  3. Set the partition count based on the expected load (a higher partition count allows more throughput).
  4. Open the new Event Hub, select Consumer groups and create a consumer group for the SamurAI collector. The $Default group can be used if no other application reads this Event Hub. Take note of the name.
  5. 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.

  1. Event Hub name
  2. Consumer group
  3. 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:

FieldValue
Event Hub nameName of the Event Hub that Defender streams to
Consumer groupThe consumer group created for the collector (default $Default)
Event Hub connection stringConnection string of the shared access policy with the Listen claim

Steps:

  1. Login to the SamurAI Portal
  2. Click Telemetry and select Integrations from the main menu
  3. Select Create
  4. Locate and click Azure Event Hubs
  5. Click Next and select the desired local collector
  6. Enter Event Hub name, Consumer group and Event Hub connection string as noted in Collect the Event Hub details
  7. 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.