O365 appendix
Collect Office365 events through Azure EventHub
This is the alternative way to collect Office365 events. It is recommended when:
- The Management API approach is not suitable for your environment
- You are using China tenants (operated by 21Vianet)
China tenants
If you are using a China tenant (21Vianet), replace portal URLs as follows:
- Azure Portal:
https://portal.azure.cn - Microsoft Purview compliance portal:
https://compliance.microsoft.cn
Prerequisites
This setup guide will show you how to generate, store and forward events produced by Office 365 service to Sekoia.io. These changes have to be made from the Azure web portal (https://portal.azure.com).
A. Event Hubs
As a prerequisite you need an Event Hubs namespace (e.g. company-eventhub) and to choose an existing resourceGroup or create a new one (e.g. company-resource-group).
You also need your Subscription ID if you don't have a default one.
Navigate to: Home > Cost Management + Billing > Subscriptions. From there, copy the relevant Subscription ID that will be used in the command line (e.g. uuid).
Then use Azure PowerShell (within the Cloud Shell interface for example): you will create a global Event Hubs namespace, then a specific Event Hub (e.g. o365-event).
PS Azure:\> az eventhubs namespace create --name company-eventhub --resource-group company-resource-group --enable-kafka true --subscription uuid
PS Azure:\> az eventhubs eventhub create --resource-group company-resource-group --namespace-name company-eventhub --name o365-event --message-retention 3 --partition-count 4 --subscription uuid
Navigate to: Home > Event Hubs > company-eventhub - Shared access policies. From there, you can create a policy (e.g. RootManageSharedAccessKey) with the claims Manage, Send and Listen, and note the Primary Key that will be used as the SharedAccessKey.
Navigate to: Home > Event Hubs > company-eventhub > o365-event - Shared access policies. From there, you can create a policy (e.g. sekoiaio) with the claim Listen.
Once created, click on the policy and save the
Connection string-primary key— it will be used when configuring the Sekoia.io playbook.
Navigate to: Home > Event Hubs > company-eventhub > o365-event - Consumer groups. From there, create a consumer group (e.g. sekoiaio).
B. Stream M365 Unified Audit logs (Exchange, SharePoint, General)
Exchange, SharePoint and General audit events are part of the M365 Unified Audit Log. They are not configured in the Azure Portal but in the Microsoft Purview compliance portal.
Note
A single streaming configuration in Microsoft Purview covers all audit log categories (Exchange, SharePoint, Teams, OneDrive, General, etc.) at once. No separate configuration per category is required.
- Go to the Microsoft Purview compliance portal (
https://compliance.microsoft.cnfor China tenants) - Navigate to
Audit > Audit log streaming - Click
Turn on streaming(if not already enabled) - Select
Stream to Azure Event Hubsas the destination - Enter the Event Hub namespace connection string and the Event Hub name created in section A
- Save the configuration
If audit logging is not yet enabled for your organization, refer to Turn auditing on or off.
Create the intake
- Go to the Sekoia.io Intakes page
- Click
+ Intake - Search for
Office 365and select the Office 365 format - Give it a name and assign it to the relevant Entity
- When prompted for the configuration mode, select
Manual— this skips the OAuth/Management API flow and provides a raw Intake Key - Copy the Intake Key — it will be used in the playbook below
Pull events
- Go to the Playbooks page
- Create a new playbook using the
Consume Eventhub messagestrigger -
Configure the trigger with the following fields:
Field Value Configuration Name A name for this configuration categories Leave empty to collect all event categories, or specify a subset Chunk Size 1000(default)Hub Connection String The Connection string-primary keyfrom theListenpolicy on your Event HubHub Consumer Group sekoiaio(or the consumer group created in section A)Hub Name The name of your Event Hub (e.g. o365-event)Intake Key The Intake Key copied from the intake created above Intake Server https://intake.sekoia.io(default)Storage Connection String The Connection string-primary keyof your Azure Storage accountStorage Container Name The name of the Azure Storage blob container -
Start the playbook and verify events flow into your Events page
Multiple clients
For each client, create a dedicated Event Hub (or separate Event Hubs within the same namespace), a dedicated Sekoia intake, and a dedicated playbook. This ensures log isolation between tenants.