> ## Documentation Index
> Fetch the complete documentation index at: https://docs.airmdr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Graph

> Microsoft Graph is an API that allows developers to access Microsoft 365 data and services. It provides a unified endpoint (https://graph.microsoft.com) to interact with various Microsoft services.

### Pre-requisites

<Check>
  Microsoft 365 Tenant & Azure AD Access

  * A **Microsoft 365 account** with **Azure Active Directory (Azure AD)** access
  * If you don’t have one, you can sign up for a free trial at [https://signup.microsoft.com](https://signup.microsoft.com) and receive an *your‑[tenant.onmicrosoft.com](http://tenant.onmicrosoft.com)* domain plus a 30‑day evaluation of Microsoft 365 and Azure AD.
</Check>

<Check>
  Azure AD App Registration Permissions

  * **Global Admin** or **App Registration Administrator** role in Azure AD is required to register an app in **Azure Active Directory**
</Check>

### Setup Microsoft Graph API

Setting up the **Microsoft Graph API** involves a few steps, including registering an app in **Azure AD** and configuring permissions.

<Steps>
  <Step title="Register an App in Azure AD">
    1. Go to [Azure Portal](https://portal.azure.com/).
    2. Search and select "Microsoft Entra ID" in the search bar.
           <img src="https://mintcdn.com/airmdr/wb8NOGyN5Zdemkpe/images/MSGraph3.png?fit=max&auto=format&n=wb8NOGyN5Zdemkpe&q=85&s=fdf861af0103ba0cbfabd85d26378198" alt="images/MSGraph3.png" width="861" height="313" data-path="images/MSGraph3.png" />
    3. Navigate to **Manage** → **App registrations.**
    4. Click **+ New registration.**
           <img src="https://mintcdn.com/airmdr/wb8NOGyN5Zdemkpe/images/MSGraph4.png?fit=max&auto=format&n=wb8NOGyN5Zdemkpe&q=85&s=d943add40d1938e0c8a2cc061e24cb3a" alt="images/MSGraph4.png" width="861" height="605" data-path="images/MSGraph4.png" />
    5. Provide:
       * **Name**: For e.g., "graphapi-client-airmdr"
       * **Supported account types**: Select “*Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant)*” option).
    6. Click **Register.**

           <Note>
             Post successful registration, the application must open automatically if not

             1. Search for Microsoft Entra ID.
             2. Select **Manage** → **App registrations.**
             3. Select the **All Applications** tab.
                1. Search and click on the registered app (For e.g., "graphapi-client-airmdr").
           </Note>
  </Step>

  <Step title="Configure API Permissions">
    1. Go to **Manage** → **API Permissions** in the app settings.
    2. Click **+ Add a permission.**
    3. Select **Microsoft Graph.**
    4. Choose **Application permissions**.
           <img src="https://mintcdn.com/airmdr/wb8NOGyN5Zdemkpe/images/MSGraph6.png?fit=max&auto=format&n=wb8NOGyN5Zdemkpe&q=85&s=b09e2c763dde04c83d0e919603d2b525" alt="images/MSGraph6.png" width="862" height="349" data-path="images/MSGraph6.png" />
    5. To use the Skills in AirMDR Integration select the required permissions as stated below:
       * **To Disable / Enable User** - `User.EnableDisableAccount.All` + `User.Read.All`
       * **To Fetch User Details** - `User.Read.All`
       * **To Fetch Audit Logs (Sign Ins or Directory Audits)** - `AuditLog.Read.All`
       * **To Reset User Password** - `User-PasswordProfile.ReadWrite.All`
       * **To Fetch User Groups** - `Directory.Read.All`
       * **To Revoke Sign-In Session** - `User.RevokeSessions.All`
       * **To Fetch Office Calendar on userId** - `Calendars.Read`
       * **To List Alerts** - `SecurityEvents.Read.All` + `SecurityAlert.Read.All` + `SecurityIncident.Read.All`
       * **To Run Hunting Query** - `ThreatHunting.Read.All`
       * **To List / Update Incident and Create Incident** - `SecurityIncident.ReadWrite.All`
       * **To Send an Email** - `Mail.Send`
    6. Click on **Add Permissions**.
    7. In API permissions, click **Grant admin consent**.
    8. In the **Grant admin consent** confirmation modal, click **Yes**.
           <img src="https://mintcdn.com/airmdr/wb8NOGyN5Zdemkpe/images/MSGraph7.png?fit=max&auto=format&n=wb8NOGyN5Zdemkpe&q=85&s=e58a12a3a4b8fa3d9e6f1ca0e6704f9c" alt="images/MSGraph7.png" width="843" height="226" data-path="images/MSGraph7.png" />
  </Step>

  <Step title="Create Client Secret (For Authentication)">
    1. In the left navigation pane, go to **Manage** → **Certificates & secrets.**
    2. Select **Client Secrets** tab.
    3. Click **+ New client secret.**
           <img src="https://mintcdn.com/airmdr/wb8NOGyN5Zdemkpe/images/MSGraph8.png?fit=max&auto=format&n=wb8NOGyN5Zdemkpe&q=85&s=c8867b2eff9b99548b9d9bd70c4e1add" alt="images/MSGraph8.png" width="845" height="344" data-path="images/MSGraph8.png" />
    4. Add a **description** and **expiration period.**
    5. Click **Add**.
           <Warning>
             Copy and securely save the **Client Secret Value** (it won’t be shown again)
           </Warning>
  </Step>

  <Step title="Securely share the Client ID and Tenant ID to AirMDR">
    To access the Client ID, and the Tenant ID to use in Graph API authentication

    1. Go to [Azure Portal](https://portal.azure.com/).
    2. Navigate to **Azure Active Directory.**
    3. Click **App registrations.**
    4. Select your **registered app.**
    5. Under the **Overview** section, locate the **Application (client) ID** and **Tenant ID (Directory ID).**
    6. Click the **Copy** icon **📋** next to the Client ID, and the Tenant ID respectively.
           <Info>
             Now, your **Tenant ID** and **Client ID** are copied and ready to use for authentication in Microsoft Graph API.
           </Info>
           <Check>
             <Icon icon="mail" /> Share the **Tenant ID**, **Client ID**, and **Client Secret Value** securely with the AirMDR operations team or self-configure them in the AirMDR Integrations Dashboard.
           </Check>
  </Step>
</Steps>

### Skills Provided by this Integration

| Skill ID           | Purpose                         |
| :----------------- | :------------------------------ |
| **Calendars.Read** | Fetch Office Calendar on userId |

### Configure Microsoft Graph in AirMDR Integrations Dashboard

1. Navigate to [AirMDR](https://app.airmdr.com/auth/login), provide the credentials and click **Login.**
   <img src="https://mintcdn.com/airmdr/wnBXbVlE7mmN9W6R/images/Datadog11.png?fit=max&auto=format&n=wnBXbVlE7mmN9W6R&q=85&s=94afec6835b90abcec516831e584184f" alt="" width="443" height="568" data-path="images/Datadog11.png" />
2. Navigate to the AirMDR Integrations Dashboard in the left navigation pane and select **Integrations.**
   <img src="https://mintcdn.com/airmdr/wnBXbVlE7mmN9W6R/images/Duo7.png?fit=max&auto=format&n=wnBXbVlE7mmN9W6R&q=85&s=eb761cfacb91ef3d08a6f7994022f6d5" alt="images/Duo7.png" width="246" height="381" data-path="images/Duo7.png" />
3. Use the search option, enter the keyword "**Microsoft Graph**", select the **Connections** tab, and click the **+ Create** icon.
   <img src="https://mintcdn.com/airmdr/wb8NOGyN5Zdemkpe/images/MSGraph2.png?fit=max&auto=format&n=wb8NOGyN5Zdemkpe&q=85&s=96326052779e377ee6f9b4bff9a47d63" alt="images/MSGraph2.png" width="1303" height="202" data-path="images/MSGraph2.png" />
4. Enter the generated **Tenant ID, Client ID** and the **Client Secret** in the Authentication Details field params, and click **Create.**
   <img src="https://mintcdn.com/airmdr/wb8NOGyN5Zdemkpe/images/MSGraph1.png?fit=max&auto=format&n=wb8NOGyN5Zdemkpe&q=85&s=ad105a5a14badc299da0ffe04553e96d" alt="images/MSGraph1.png" width="718" height="583" data-path="images/MSGraph1.png" />
