Microsoft Defender XDR ListAlerts

Microsoft Defender XDR ListAlerts

Certified

List Microsoft Defender XDR alerts

Lists alerts from the Microsoft Graph security API (/security/alerts_v2) in the order Microsoft Graph returns them, following @odata.nextLink until top alerts are collected. Requires the Microsoft Graph application permission SecurityAlert.Read.All.

yaml
type: io.kestra.plugin.microsoft365.defender.ListAlerts

Store all new high-severity alerts in internal storage

yaml
id: defender_list_high_alerts
namespace: company.security

inputs:
  - id: severity
    type: SELECT
    values: [INFORMATIONAL, LOW, MEDIUM, HIGH]
    defaults: HIGH

tasks:
  - id: list_alerts
    type: io.kestra.plugin.microsoft365.defender.ListAlerts
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    severity: "{{ inputs.severity }}"
    status: NEW
    top: 200
    fetchType: STORE

  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "{{ outputs.list_alerts.count }} open {{ inputs.severity }} alerts written to {{ outputs.list_alerts.uri }}"

List Defender for Endpoint alerts with a raw OData filter

yaml
id: defender_list_endpoint_alerts
namespace: company.security

tasks:
  - id: list_alerts
    type: io.kestra.plugin.microsoft365.defender.ListAlerts
    tenantId: "{{ secret('AZURE_TENANT_ID') }}"
    clientId: "{{ secret('AZURE_CLIENT_ID') }}"
    clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
    filter: "serviceSource eq 'microsoftDefenderForEndpoint'"
    top: 50
    fetchType: FETCH
Installation

Our standard Docker images already include this plugin. If you use a -slim image or another setup, install it with the following command:

kestractl plugins get io.kestra.plugin:plugin-microsoft365 --compatible-for $KESTRA_VERSION

For kestractl, use your Kestra version with --compatible-for, or specify an exact plugin version.

Properties

Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.

Definitions
assetFailureBehaviorstring
Possible Values
IGNOREFAILWARN

Asset failure behavior

Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.

enableAutobooleanstring

Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.

inputsarray

The assets consumed as inputs.

id*string
Min length1
typestring
outputs

The assets produced as outputs.

id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*object
descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150
id*string
Min length1
Max length150
type*string
Min length1

Custom asset type

descriptionstring
displayNamestring
metadataobject
Default{}
namespacestring
Min length1
Max length150

Client ID

Client ID of the Azure service principal. If you don't have a service principal, refer to create a service principal with Azure CLI.

Client Secret

Service principal client secret. Use this for Client Secret authentication. Provide clientId, tenantId, and clientSecret. Either clientSecret OR pemCertificate must be provided, not both.

DefaultFETCH
Possible Values
STOREFETCHFETCH_ONENONE

How to output the alerts

FETCH - outputs the alerts as alerts FETCH_ONE - outputs the first alert as alert STORE - stores the alerts in an ION file and outputs its uri NONE - only outputs count

Default FETCH.

OData filter

Raw OData $filter expression, e.g. serviceSource eq 'microsoftDefenderForEndpoint'. Combined with severity and status using and.

PEM Certificate

Alternative authentication method using certificate-based authentication.
Use this for Client Certificate authentication. Provide clientId, tenantId, and pemCertificate.
Either clientSecret OR pemCertificate must be provided, not both.

Possible Values
INFORMATIONALLOWMEDIUMHIGH

Severity

Only return alerts with this severity. Allowed values: INFORMATIONAL, LOW, MEDIUM, HIGH.

Possible Values
NEWIN_PROGRESSRESOLVED

Status

Only return alerts with this status. Allowed values: NEW, IN_PROGRESS, RESOLVED.

Tenant ID

Default100

Maximum number of alerts

Between 1 and 2000. Default 100.

First alert (FETCH_ONE)

SubTypeobject

Alerts (FETCH)

Alert objects with the Microsoft Graph field names.

Default0

Number of alerts retrieved

Formaturi

URI of the ION file with the alerts (STORE)