Microsoft Defender XDR
Developer and API

Create custom Microsoft Defender XDR reports using Microsoft Graph security API and Power BI

In brief

The article now refers to required RBAC permissions, expands OData, and documents relative lookback and date-parameter queries for Microsoft Graph alert and incident data. It also updates wording and metadata.

What Defender admins need to know

No administrator action is required. Administrators and report authors get clearer guidance on permissions and Power BI query parameters.

Summaries are generated from the documentation change itself.

Documentation change

The comparison below shows only the changed extract. Use the full-page view for complete context.

Create custom Microsoft Defender XDR reports using Microsoft Graph security API and Power BI

  • Applying the render function in Advanced Hunting.
  • Using Power BI to expand existing reporting capabilities.

In this article, we create a sample Security Operations Center (SOC) efficiency dashboard in Power BI using Microsoft Graph security API. We access the Microsoft Graph security API in user context, therefore the user must have the required RBAC permissions to be able to view alerts and incidents data.

Filter Microsoft Defender XDR report data in Power BI

Microsoft Graph API supports the OData (OpenOpen Data Protocol)Protocol (OData) query protocol for filtering and pagination, so users don't have to worry about pagination - or requesting the next page of results. However, filtering data is essential to improving load times in a busy environment.

Microsoft Graph API supports query parameters. Here are few examples of filters used in the report:

  • The following query returns the list ofcalculates a relative lookback date and retrieves recent alerts generated overfrom Microsoft Graph for the past three days. Using this query in environments with high volumes of data might result in hundreds of megabytes of data that could take a moment to load. By using this hardcoded approach, you're able to quickly see your most recent alerts over the last three days as soon as you open the report.

    let
        Source
    
  • When historical data is required (for example, comparing the number of incidents per month), filtering by date isn't an option (since we want to go as far back as possible). In this case, pullthe following query uses date parameters to retrieve alerts from Microsoft Graph and selects only selectedkey fields such as id, title, severity, and createdDateTime:createdDateTime to reduce the data volume:

    let
    
     :::image type="content" source="media/defender-xdr-custom-reports/manage-parameters.png" alt-text="Screenshot of how to manage Parameters in Power BI." lightbox="media/defender-xdr-custom-reports/manage-parameters.png":::
    
  1. Remove hardcoded values from the queries and make sure that StartDate and EndDate variable names correspond to parameter names:names. The following parameterized query retrieves incidents created within the date range defined by the StartDate and EndDate parameters:

    let
    

Review the custom Microsoft Defender XDR report

Once theMicrosoft Defender alert and incident data has been queried and the parameters are set, now weyou can review the report. During the first launch of the Power BI template (.pbit) file, you're prompted to provide the StartDate and EndDate parameters:

:::image type="content" source="media/defender-xdr-custom-reports/soc-overview-dashboard.png" alt-text="Screenshot of the Power BI template parameter prompt window." lightbox="media/defender-xdr-custom-reports/soc-overview-dashboard.png":::

The dashboard offers three tabs intended to provide SOC insights. The first tab provides a summary of all recent alerts (depending on the selected timeframe). ThisThe first tab helps analysts clearly understand the security state over their environment using alert details broken down by detection source, severity, total number of alerts and mean-time-to-resolution.

:::image type="content" source="media/defender-xdr-custom-reports/alert-tab-powerbi.png" alt-text="Screenshot of the alerts tab of resulting Power BI report." lightbox="media/defender-xdr-custom-reports/alert-tab-powerbi.png":::

The second tab offers more insight into the attack data collected across the incidents and alerts. This viewThe second tab can provide analysts with greater perspective into the types of attacks executed and how they map to the MITRE ATT&CK framework, a knowledge base that categorizes adversary tactics and techniques.

:::image type="content" source="media/defender-xdr-custom-reports/insights-tab-powerbi.png" alt-text="Screenshot of the insights tab of resulting Power BI report." lightbox="media/defender-xdr-custom-reports/insights-tab-powerbi.png":::