Skip to content

Send Microsoft Graph and Microsoft Office logs from one tenant to another using Data Collection Endpoints and Data Collection Rules

Notifications You must be signed in to change notification settings

Accelerynt-Security/AS-Microsoft-DCR-Log-Ingestion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AS-Microsoft-DCR-Log-Ingestion

Author: Accelerynt

For any technical questions, please contact info@accelerynt.com

Deploy to Azure Deploy to Azure Gov

This playbook is designed for multitenant environments to facilitate Microsoft Entra and Microsoft Office log collection in Microsoft Sentinel via Data Collection Endpoints and Data Collection Rules (DCRs). Microsoft’s built-in connectors lack multitenant support, so this playbook bridges that limitation by retrieving logs from a designated tenant and integrating them into another tenant’s Sentinel workspace. It supports the following log types:

DCRLogIngestion_Demo_1

DCRLogIngestion_Demo_2

Note

Estimated Time to Complete: 3 hours

Tip

Required deployment variables are noted throughout. Reviewing the deployment page and filling out fields as you proceed is recommended.

Requirements

The following items are required under the template settings during deployment:

Log Source:

  • Subscription ID - this can be found by logging into your source tenant and navigating to the Microsoft subscriptions page.
  • Entra App Registration - this needs to be created to send data to the DCR, with admin consent granted for "AuditLog.Read.All" and "Activity.Feed.Read". Documentation link.

Log Destination:

  • Entra App Registration - this needs to be created to access the DCR, with the "Monitoring Metrics Publisher" role assigned from each DCR you create. Documentation link.
  • Azure Key Vault Secrets - these will store both source and destination app registration client secrets. Documentation links: source, destination.
  • Workspace Location - this will need to be noted as it must be consistent in creating resources such as data collection rules and endpoints. This is the value under "Location" on the Microsoft workspaces page.
  • Data Collection Endpoints - these will need to be created for each of the three log sources. Documentation link.
  • Data Collection Rules - these will need to be created for each of the three log sources. Documentation link.

Role Requirements

If the user that will be performing the setup and deployment steps does not have the "Owner" or "Global Administrator" role assigned in both tenants, the following additional roles may be required:

Log Source Tenant Roles:

  • Privileged Role Administrator - This role will need to be assigned to the user from Entra ID.
  • Application Administrator - By default, any user can create an app registration. However, if this has been locked down, this role will need to be assigned from Entra ID.

Log Destination Tenant Roles:

  • Key Vault Secrets Officer - In order to create and manage secrets within the desired key vault, this role will need to be assigned to the user from the key vault access control (IAM) page.
  • User Access Administrator - In order to add role assignments to DCRs, this role will need to be assigned to the user from the resource group.
  • Contributor - In order to add role assignments to DCRs, this role will need to be assigned to the user from the resource group.

Setup

Create an App Registration

From the tenant holding the log source data, navigate to the Microsoft Azure Active Directory app registration page: https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade

Click "New registration".

DCRLogIngestion_App_Registration_1

Enter something like "AS-Send-Logs-to-DCR" as the name and select "Accounts in any organizational directory" for "Supported account types". All remaining fields can be left unchanged. Click "Register"

DCRLogIngestion_App_Registration_2

Once the app registration is created, you will be redirected to the "Overview" page. Under the "Essentials" section, take note of the "Application (client) ID" and the "Directory (tenant) ID", as both will be needed for deployment.

DCRLogIngestion_App_Registration_3

Next, you will need to add permissions for the app registration to call the Microsoft Graph and Office 365 API endpoints. From the left menu blade, click "API permissions" under the "Manage" section. Then, click "Add a permission".

DCRLogIngestion_App_Registration_4

From the "Select an API" pane, click the "Microsoft APIs" tab and select "Microsoft Graph".

DCRLogIngestion_App_Registration_5

Click "Application permissions", then paste "AuditLog.Read.All" in the search bar. Click the option matching the search, then click "Add permission".

DCRLogIngestion_App_Registration_6

This process will need to be repeated for the Office 365 API. Click "Add a permission" once again and from the "Select an API" pane, click the "Microsoft APIs" tab and select "Office 365 Management APIs".

DCRLogIngestion_App_Registration_7

Click "Application permissions", then paste "ActivityFeed.Read" in the search bar. Click the option matching the search, then click "Add permission".

DCRLogIngestion_App_Registration_8

Admin consent will be needed before your app registration can use the assigned permission. Click "Grant admin consent for (name)".

DCRLogIngestion_App_Registration_9

Lastly, a client secret will need to be generated for the app registration. From the left menu blade, click "Certificates & secrets" under the "Manage" section. Then, click "New client secret".

DCRLogIngestion_App_Registration_10

Enter a description and select the desired expiration date, then click "Add".

DCRLogIngestion_App_Registration_11

Copy the value of the secret that is generated, as this will be needed for Create an Azure Key Vault Secret.

DCRLogIngestion_App_Registration_12

Create an App Registration Azure Key Vault Secret

The secret from the previous step will need to be stored in the log destination tenant, as this is where the logic app will be deployed. Navigate to the Azure key vaults page: https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.KeyVault%2Fvaults

Navigate to an existing key vault or create a new one. From the key vault overview page, click the "Secrets" menu option, found under the "Settings" section. Click "Generate/Import".

DCRLogIngestion_Key_Vault_1

Choose a name for the secret, such as "DCRLogIngestion-LogSourceAppRegClientSecret", taking note of the value used, as it will be needed for deployment. Next, enter the client secret copied in the previous section. All other settings can be left as is. Click "Create".

DCRLogIngestion_Key_Vault_2

Create the Data Collection Endpoints

From the tenant holding the log destination data, navigate to the Microsoft data collection endpoints page: https://portal.azure.com/#browse/microsoft.insights%2Fdatacollectionendpoints

Click "Create".

DCRLogIngestion_Data_Collection_Endpoint_1

Enter something like "EntraSignInLogsDCE" as the endpoint name and select the subscription and resource group. These should match the subscription and resource group of the playbook you will deploy later. Ensure the region matches the location of your workspace. Click "Review + create".

DCRLogIngestion_Data_Collection_Endpoint_2

Click "Create".

DCRLogIngestion_Data_Collection_Endpoint_3

Repeat this process for "EntraAuditLogsDCE".

DCRLogIngestion_Data_Collection_Endpoint_4

Repeat this process for "OfficeActivityLogsDCE".

DCRLogIngestion_Data_Collection_Endpoint_5

From each of the created Data Collection Endpoint overview pages, take note of the "Logs Ingestion" URLs, as they will be needed for deployment.

DCRLogIngestion_Data_Collection_Endpoint_6

Create the Data Collection Rules

From the tenant holding the log destination data, navigate to the Microsoft Log Analytics Workspace page: https://portal.azure.com/#browse/Microsoft.OperationalInsights%2Fworkspaces

Select the desired workspace.

DCRLogIngestion_Data_Collection_Rule_1

From the selected workspace, navigate to "Tables" located under settings, click "Create" and select "New custom log (DCR based)".

DCRLogIngestion_Data_Collection_Rule_2

First, click "Create a new Data Collection Rule" below the Data Collection Rule field. Then enter something like "EntraSignInLogsDCR" for the name in the window that appears on the right. Ensure the Subscription, Resource Group, and Region all look correct, then click "Done".

DCRLogIngestion_Data_Collection_Rule_3

Next enter something like "EntraSignInLogs" as the table name and select "EntraSignInLogsDCE" from the drop-down list. If this option is not populating, double check the region used for the Data Collection Endpoint created in the previous step. Click "Next".

DCRLogIngestion_Data_Collection_Rule_4

The next step will prompt you for a data sample.

DCRLogIngestion_Data_Collection_Rule_5

Upload the file content located at Samples/SignInLogsSample.json, then click "Next".

DCRLogIngestion_Data_Collection_Rule_6

Click "Create".

DCRLogIngestion_Data_Collection_Rule_7

This process will need to be repeated for "EntraAuditLogsDCR". After creating the "EntraAuditLogsDCR" Data Collection Rule in the way that was shown for "EntraSignInLogsDCR", enter something like "EntraAuditLogs" as the table name and select "EntraAuditLogsDCE" from the drop-down list.

DCRLogIngestion_Data_Collection_Rule_8

Upload the file content located at Samples/AuditLogsSample.json, then click "Next".

DCRLogIngestion_Data_Collection_Rule_9

Click "Create".

DCRLogIngestion_Data_Collection_Rule_10

This process will need to be repeated for "OfficeActivityLogsDCR". After creating the "OfficeActivityLogsDCR" Data Collection Rule in the way that was shown for “EntraSignInLogsDCR", enter something like "OfficeActivityLogs" as the table name and select "OfficeActivityLogsDCE" from the drop down list.

DCRLogIngestion_Data_Collection_Rule_11

Upload the file content located at Samples/OfficeActivityLogsSample.json, then click "Next".

DCRLogIngestion_Data_Collection_Rule_12

Click "Create".

DCRLogIngestion_Data_Collection_Rule_13

From each of the created Data Collection Rule overview pages, take note of the "Immutable ID" values, as they will be needed for deployment.

DCRLogIngestion_Data_Collection_Rule_14

Lastly, from each of the created Data Collection Rule data sources pages, take note of the "Data source" values, as they will be needed for deployment.

DCRLogIngestion_Data_Collection_Rule_15

Create an App Registration for the DCRs

From the tenant holding the log destination data, navigate to the Microsoft Azure Active Directory app registration page: https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade

Click "New registration".

DCRLogIngestion_App_Registration_DCR_1

Enter something like "DCRLogIngestionAppReg" for the name and select "Accounts in this organizational directory only" for "Supported account types. All remaining fields can be left unchanged. Click "Register"

DCRLogIngestion_App_Registration_DCR_2

Once the app registration is created, you will be redirected to the "Overview" page. Under the "Essentials" section, take note of the "Application (client) ID", as this will be needed for deployment.

DCRLogIngestion_App_Registration_DCR_3

A client secret will need to be generated for the app registration. From the left menu blade, click "Certificates & secrets" under the "Manage" section. Then, click "New client secret”. Enter a description and select the desired expiration date, then click "Add".

DCRLogIngestion_App_Registration_DCR_4

Copy the value of the secret that is generated, as this will be needed for Create an Azure Key Vault Secret.

DCRLogIngestion_App_Registration_DCR_5

Next, IAM access for this app registration will need to be added from each of the DCRs created in the previous step. Navigate to the data collection rules page: https://portal.azure.com/#browse/microsoft.insights%2Fdatacollectionrules

Select the "EntraSignInLogsDCR" and select "Access control (IAM)". Click "Add" and select "Add role assignment".

DCRLogIngestion_App_Registration_DCR_6

Select "Monitoring Metrics Publisher" and click "Next".

DCRLogIngestion_App_Registration_DCR_7

Select "User, group, or service principal" as the access option, then click "Select members". Paste "DCRLogIngestionAppReg" into the search bar at the top of the right pane and select the app registration that appears, then click "Select".

DCRLogIngestion_App_Registration_DCR_8

Click "Review + assign".

DCRLogIngestion_App_Registration_DCR_9

Repeat this process for the "EntraAuditLogsDCR".

DCRLogIngestion_App_Registration_DCR_10

Lastly, repeat this process for "OfficeActivityLogsDCR".

DCRLogIngestion_App_Registration_DCR_11

Create a Log Destination App Registration Azure Key Vault Secret

As before, the secret from the previous step will need to be stored in the log destination tenant. Navigate to the Azure key vaults page: https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.KeyVault%2Fvaults

Navigate to an existing key vault or create a new one. From the key vault overview page, click the "Secrets" menu option, found under the "Settings" section. Click "Generate/Import".

DCRLogIngestion_Receiving_Key_Vault_1

Choose a name for the secret, such as "DCRLogIngestion-Log-DestinationAppRegClientSecret", taking note of the value used, as it will be needed for deployment. Next, enter the client secret copied in the previous section. All remaining fields can be left unchanged. Click "Create".

DCRLogIngestion_Receiving_Key_Vault_2

Deployment

To configure and deploy this playbook:

Open your browser and ensure you are logged into your Microsoft Sentinel workspace From the tenant holding the log destination data. In a separate tab, open the link to our playbook on the Accelerynt Security GitHub repository:

https://github.com/Accelerynt-Security/AS-Microsoft-DCR-Log-Ingestion

Deploy to Azure Deploy to Azure Gov

Click the "Deploy to Azure" button at the bottom and it will bring you to the custom deployment template.

In the Project Details section:

  • Select the "Subscription" and "Resource Group" from the dropdown boxes you would like the playbook deployed to.

In the Instance Details section:

Towards the bottom, click on "Review + create".

DCRLogIngestion_Deploy_1

Once the resources have validated, click on "Create".

DCRLogIngestion_Deploy_2

The resources should take around a minute to deploy. Once the deployment is complete, you can expand the "Deployment details" section to view them. Click the one corresponding to the Logic App.

DCRLogIngestion_Deploy_3

Granting Access to Azure Key Vault

Before the Logic App can run successfully, the key vault connection created during deployment must be granted access to the key vault storing your app registration client secrets, located in the log destination tenant.

From the Logic App menu blade, select the "Identity" tab, located under the "Settings" section. Click "Azure role assignments".

DCRLogIngestion_Key_Vault_Access_1

Click "Add role assignment" then select "Key Vault" as the scope, select your key vault name, then select "Key Vault Secrets User" for the role. Click "Save".

DCRLogIngestion_Key_Vault_Access_2

Ensuring your Subscription is Enabled

To ensure the subscription is enabled for the app registration used to access the "O365 Audit General Logs", the OfficeAuditSubscriptionEnable should be run from an Azure Cloud Shell Window From the tenant holding the log source data.

DCRLogIngestion_Azure_Cloud_Shell_1

Click the "PowerShell" option, then select the appropriate subscription for the log source tenant.

DCRLogIngestion_Azure_Cloud_Shell_2

Copy and paste the script into the Azure Cloud Shell PowerShell window and hit enter. You will be prompted to enter your log source tenant, as well as the log source app registration client ID and client secret.

DCRLogIngestion_Azure_Cloud_Shell_3

You should see a status of "enabled" once the script runs successfully.

DCRLogIngestion_Azure_Cloud_Shell_4

Enable the Logic App

After all of the above steps are completed, from the Logic App Overview page, click "Enable".

DCRLogIngestion_Logic_App_Enable_1

Once the playbook has run successfully, navigate to https://portal.azure.com/#browse/microsoft.securityinsightsarg%2Fsentinel in your log destination tenant. Select the corresponding workspace and navigate to "Logs". From there, the tables you created in the Create the Data Collection Endpoints section can be queried to verify that the data is flowing to your log destination tenant properly.

DCRLogIngestion_Logic_App_Enable_2

About

Send Microsoft Graph and Microsoft Office logs from one tenant to another using Data Collection Endpoints and Data Collection Rules

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published