Skip to content

[azure,o365,microsoft_defender_endpoint,m365_defender] Standardize ECS in Microsoft Integrations #13931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

mohitjha-elastic
Copy link
Contributor

@mohitjha-elastic mohitjha-elastic commented May 19, 2025

Proposed Commit Message

azure,m365_defender,microsoft_defender_endpoint,o365: set some ECS fields to standarize the names across
all the microsoft integrations.

* azure: set `service.id`, `device.id`, `user.id`, `session.id`, and `token.id` in graphactivitylogs dataset.
* m365_defender: set `device.id` ECS in all the dataset and `application.name` in event dataset.
* microsoft_defender_endpoint: set device.id from microsoft_defender_endpoint.machine.aad_device_id.
* o365: set `application.name`, `device.id`, `session.id`, and `token.id` in audit dataset.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

How to test this PR locally

To test azure integration

Clone integrations repo.
Install the elastic package locally.
Start the elastic stack using the elastic package.
Move to integrations/packages/azure directory.
Run the following command to run tests.
elastic-package test -v

To test m365_defender integration

Clone integrations repo.
Install the elastic package locally.
Start the elastic stack using the elastic package.
Move to integrations/packages/m365_defender directory.
Run the following command to run tests.
elastic-package test -v

To test microsoft_defender_endpoint integration

Clone integrations repo.
Install the elastic package locally.
Start the elastic stack using the elastic package.
Move to integrations/packages/microsoft_defender_endpoint directory.
Run the following command to run tests.
elastic-package test -v

To test o365 integration

Clone integrations repo.
Install the elastic package locally.
Start the elastic stack using the elastic package.
Move to integrations/packages/o365 directory.
Run the following command to run tests.
elastic-package test -v

Related issues

@mohitjha-elastic mohitjha-elastic self-assigned this May 19, 2025
@mohitjha-elastic mohitjha-elastic requested review from a team as code owners May 19, 2025 12:07
@mohitjha-elastic mohitjha-elastic added enhancement New feature or request Integration:azure Azure Logs Integration:o365 Microsoft Office 365 Integration:microsoft_defender_endpoint Microsoft Defender for Endpoint Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Team:Sit-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors] labels May 19, 2025
@elasticmachine
Copy link

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@mohitjha-elastic mohitjha-elastic changed the title azure/o365/microsoft_defender_endpoint: Standarize ECS in Microsoft Integrations azure/o365/microsoft_defender_endpoint: Standardize ECS in Microsoft Integrations May 19, 2025
@elastic-vault-github-plugin-prod
Copy link

elastic-vault-github-plugin-prod bot commented May 19, 2025

🚀 Benchmarks report

Package microsoft_defender_endpoint 👍(0) 💚(0) 💔(3)

Expand to view
Data stream Previous EPS New EPS Diff (%) Result
log 3508.77 1398.6 -2110.17 (-60.14%) 💔
machine 2336.45 1438.85 -897.6 (-38.42%) 💔
machine_action 7042.25 5882.35 -1159.9 (-16.47%) 💔

To see the full report comment with /test benchmark fullreport

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest commit message:

azure,microsoft_defender_endpoint,o365: map source-specific fields to ECS fields

* azure: *.properties.service_principal_id and *.properties.c_device_id to
  service.id and device.id respectively
* microsoft_defender_endpoint: microsoft_defender_endpoint.machine.aad_device_id
  to device.id
* o365: o365.audit.AppAccessContext.DeviceId to device.id

@@ -1,3 +1,8 @@
- version: "1.24.0"
changes:
- description: Map `service.id` and `device.id` ECS fields to the `*.properties.service_principal_id` and `*.properties.c_device_id` fields, respectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are more fields defined in the requirement: #13369 (comment) for o365 and azure integrations such as user.*, application.*, session.*.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have only picked up the data streams and integrations that are owned by the security team. One such example is graphactivity data stream (from Azure). During this process, we attempted to map all relevant fields to the ECS schema. However, fields such as application.* and session.* are not part of the current ECS schema and therefore could not be mapped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ask was to manually define these fields (if not present in ECS). Example. Also if you don't have sample data to populate these fields inside tests, please request them in the issue so they can DM you.

Update changelog descriptions as per suggestions.
…standarize_names_in_microsoft_integrations

Conflicts:
	packages/azure/changelog.yml
	packages/azure/manifest.yml
@mohitjha-elastic mohitjha-elastic requested review from kcreddy and efd6 May 20, 2025 12:12
@efd6
Copy link
Contributor

efd6 commented May 20, 2025

There is a confused GH user out there somewhere; my handle is not capitalised.

Copy link
Contributor

@efd6 efd6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but there are outstanding concerns from @kcreddy, so waiting for him.

Set service.id, device.id, user.id, session.id and token.id in graphactivitylogs dataset in azure.
Set device.id ECS in all the dataset and application.name in event dataset in m365_defender.
Set application.name, device.id, session.id, and token.id in audit dataset in o365.
…standarize_names_in_microsoft_integrations

Conflicts:
	packages/m365_defender/changelog.yml
	packages/m365_defender/data_stream/alert/sample_event.json
	packages/m365_defender/data_stream/incident/sample_event.json
	packages/m365_defender/docs/README.md
	packages/microsoft_defender_endpoint/changelog.yml
	packages/microsoft_defender_endpoint/data_stream/machine/sample_event.json
	packages/microsoft_defender_endpoint/docs/README.md
…standarize_names_in_microsoft_integrations

Conflicts:
	packages/o365/changelog.yml
	packages/o365/manifest.yml
@mohitjha-elastic mohitjha-elastic changed the title azure/o365/microsoft_defender_endpoint: Standardize ECS in Microsoft Integrations azure/o365/microsoft_defender_endpoint/m365_defender: Standardize ECS in Microsoft Integrations May 26, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we already have base-fields.yml this name might be confusing.
Can you rename the file to ecs-extended.yml and we can understand slightly better as there are RFCs in ECS adding them in the future.

Similarly for other data streams.

@andrewkroh andrewkroh added the Integration:m365_defender Microsoft M365 Defender label May 26, 2025
Copy link
Contributor

@zmoog zmoog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the PR is security-focused.

Approving on behalf of the elastic/obs-ds-hosted-services team based on co-ownership of packages/azure/(changelog|manifest).yml and packages/azure/docs/.

…standarize_names_in_microsoft_integrations

Conflicts:
	packages/m365_defender/changelog.yml
	packages/m365_defender/data_stream/alert/sample_event.json
	packages/m365_defender/data_stream/incident/sample_event.json
	packages/m365_defender/docs/README.md
	packages/microsoft_defender_endpoint/changelog.yml
	packages/microsoft_defender_endpoint/data_stream/log/sample_event.json
	packages/microsoft_defender_endpoint/docs/README.md
Add description for the fields.
Update standard-fields file name to extended-ecs
@mohitjha-elastic mohitjha-elastic changed the title azure/o365/microsoft_defender_endpoint/m365_defender: Standardize ECS in Microsoft Integrations [azure,o365,microsoft_defender_endpoint,m365_defender] Standardize ECS in Microsoft Integrations May 27, 2025
@mohitjha-elastic mohitjha-elastic requested a review from kcreddy May 27, 2025 10:43
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @mohitjha-elastic

Copy link

@kcreddy kcreddy merged commit d058c47 into elastic:main May 27, 2025
8 checks passed
@elastic-vault-github-plugin-prod

Package azure - 1.24.0 containing this change is available at https://epr.elastic.co/package/azure/1.24.0/

@elastic-vault-github-plugin-prod

Package m365_defender - 3.7.0 containing this change is available at https://epr.elastic.co/package/m365_defender/3.7.0/

@elastic-vault-github-plugin-prod

Package microsoft_defender_endpoint - 2.37.0 containing this change is available at https://epr.elastic.co/package/microsoft_defender_endpoint/2.37.0/

@elastic-vault-github-plugin-prod

Package o365 - 2.17.0 containing this change is available at https://epr.elastic.co/package/o365/2.17.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Integration:azure Azure Logs Integration:m365_defender Microsoft M365 Defender Integration:microsoft_defender_endpoint Microsoft Defender for Endpoint Integration:o365 Microsoft Office 365 Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Team:Sit-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants