> For the complete documentation index, see [llms.txt](https://docs.balkan.id/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.balkan.id/playbooks/outbound-webhooks/microsoft-sentinel-via-logic-apps.md). Agents can also search and read this documentation through its [MCP server](https://docs.balkan.id/~gitbook/mcp).

# Microsoft Sentinel (via Logic Apps)

Send BalkanID webhook events to Microsoft Sentinel by using an Azure Logic App and the Azure Monitor Logs Ingestion API.

This guide shows you how to send BalkanID webhook events to Microsoft Sentinel.

### How it works

Microsoft Sentinel reads data from a Log Analytics workspace. Data reaches the workspace through the [Azure Monitor Logs Ingestion API](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-ingestion-api-overview), which requires each request to include a Microsoft Entra ID bearer token in the `Authorization` header and a request body formatted as a JSON array.

An [Azure Logic App](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-overview) connects the two:

1. BalkanID sends each event to the Logic App.
2. The Logic App authenticates with its [managed identity](https://learn.microsoft.com/en-us/azure/logic-apps/authenticate-with-managed-identity), so you don't store any credentials or secrets. It then forwards the event to the Logs Ingestion API.
3. Azure Monitor writes the event to a custom table in your Log Analytics workspace.
4. Microsoft Sentinel reads from the workspace, so the event is available in Microsoft Sentinel.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FmFlBjqOO2bHsEZRwp1AS%2Fbalkanid-sentinel-flow.png?alt=media&#x26;token=92bc68bc-cdc5-4ff1-8e3e-124b360c5a6f" alt="Diagram with four boxes connected by arrows: BalkanID webhook, Azure Logic App, Log Analytics workspace with the BalkanIDUsers_CL table, and Microsoft Sentinel."><figcaption><p>How BalkanID events reach Microsoft Sentinel</p></figcaption></figure></div>

### Terms used in this guide

| Term                         | Meaning                                                                                     |
| ---------------------------- | ------------------------------------------------------------------------------------------- |
| **Subscription**             | Your organization's Azure billing account. Resources you create are billed to it.           |
| **Resource group**           | A container that holds the Azure resources you create in this guide.                        |
| **Log Analytics workspace**  | Where Azure Monitor stores log data. Microsoft Sentinel reads from it.                      |
| **Data collection endpoint** | The address that receives events for the Logs Ingestion API.                                |
| **Data collection rule**     | Describes incoming data and which table to write it to. Azure creates it for you in Step 6. |
| **Logic App**                | The Azure workflow that receives BalkanID events and forwards them to Azure Monitor.        |
| **Webhook**                  | An HTTP request that BalkanID sends when an event occurs, such as when a user is created.   |

### Before you begin

* **BalkanID:** You're a tenant administrator, and **Outbound Webhooks** is turned on for your tenant. If you don't see **Configure → Webhooks**, contact BalkanID Support or your customer success representative. See [Outbound Webhooks](https://docs.balkan.id/playbooks/outbound-webhooks.md).
* **Azure:** You have the **Owner** role on the Azure subscription that you plan to use. Registering resource providers requires the Contributor or Owner role ([Azure resource providers and types](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types#register-resource-provider)). Enabling Microsoft Sentinel requires Contributor permissions on the subscription ([Onboard to Microsoft Sentinel](https://learn.microsoft.com/en-us/azure/sentinel/quickstart-onboard#prerequisites)). Step 9 requires permission to assign roles.
* **Costs:** The resources in this guide are billed to your Azure subscription. Review the pricing pages linked in each step before you begin.

{% hint style="info" %}
Create every resource in this guide in the same Azure region, for example **East US**.
{% endhint %}

This guide uses the following example names. You can replace them with your own.

| Resource                 | Example name              |
| ------------------------ | ------------------------- |
| Resource group           | `rg-balkanid-sentinel`    |
| Log Analytics workspace  | `law-balkanid`            |
| Data collection endpoint | `dce-balkanid`            |
| Table                    | `BalkanIDUsers`           |
| Data collection rule     | `dcr-balkanid-users`      |
| Logic App                | `la-balkanid-to-sentinel` |

### Step 1: Register the Azure resource providers

Azure requires your subscription to be registered for a resource provider before you use it ([Azure resource providers and types](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-providers-and-types#register-resource-provider)). This guide uses three resource providers.

1. Sign in to the [Azure portal](https://portal.azure.com).
2. Search for **Subscriptions** and select it.
3. Select your subscription.
4. In the left menu, select **Settings → Resource providers**.
5. Search for `Microsoft.Insights`, select it, and then select **Register**.
6. Repeat for `Microsoft.Logic` and `Microsoft.OperationalInsights`.
7. Select **Refresh** until all three show **Registered**.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FPQZJmwW8xoJO60vS23R9%2Fimage.png?alt=media&#x26;token=18170741-623f-409c-a8a3-98b7c53bd735" alt="Azure portal Resource providers page for a subscription, showing Microsoft.Insights with the status Registered."><figcaption><p>Registering resource providers on the subscription</p></figcaption></figure></div>

### Step 2: Create a resource group

1. Search for **Resource groups** and select it.
2. Select **Create**.
3. Enter the following:
   * **Subscription:** your subscription
   * **Resource group:** `rg-balkanid-sentinel`
   * **Region:** your region
4. Select **Review + create**, and then select **Create**.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FdlAbsFra1Svcxm0JwsI4%2Fimage.png?alt=media&#x26;token=75687f9e-5fb7-45ad-a37c-c8f9f4a6d88a" alt="Create a resource group form in the Azure portal with the subscription, resource group name, and region filled in."><figcaption><p>Creating the resource group</p></figcaption></figure></div>

### Step 3: Create a Log Analytics workspace

1. Search for **Log Analytics workspaces** and select it.
2. Select **Create**.
3. Enter the following:
   * **Subscription:** your subscription
   * **Resource group:** `rg-balkanid-sentinel`
   * **Name:** `law-balkanid`
   * **Region:** your region
4. Select **Review + create**. Confirm that **Validation passed** appears.
5. Select **Create**. When deployment finishes, select **Go to resource**.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FQRL3ZKUxAOyI7KOC2NWH%2Fimage.png?alt=media&#x26;token=edf6fc94-b19d-4431-ac82-0a3f8203e013" alt="Create Log Analytics workspace page on the Review + Create tab, showing Validation passed and the pricing tier."><figcaption><p>Reviewing the Log Analytics workspace before creation</p></figcaption></figure></div>

{% hint style="info" %}
**Optional:** A daily cap stops the collection of billable log data for the rest of the day after the cap is reached ([Set daily cap on Log Analytics workspace](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/daily-cap)). To set one, open the workspace, select **Settings → Usage and estimated costs → Daily cap**, select **ON**, and enter a limit in GB/day.
{% endhint %}

### Step 4: Create a data collection endpoint

1. Search for **Data collection endpoints** and select it.
2. Select **Create**.
3. Enter the following:
   * **Endpoint Name:** `dce-balkanid`
   * **Subscription:** your subscription
   * **Resource Group:** `rg-balkanid-sentinel`
   * **Region:** your region
4. Select **Review + create**, and then select **Create**.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FnAIY6ff7SLn04LwYEj3j%2Fimage.png?alt=media&#x26;token=02346a3e-53d1-462a-8d63-99adf110c5f8" alt="Create data collection endpoint page on the Review + create tab with the endpoint name, subscription, and resource group."><figcaption><p>Creating the data collection endpoint</p></figcaption></figure></div>

### Step 5: Save the sample event file

Azure uses a sample event to define the columns of your table.

1. Copy the following JSON into a plain text editor.
2. Save the file as `user.created.json`.

{% code title="user.created.json" %}

```json
[
  {
    "tenantId": "TEST_TENANT_ID",
    "employeeId": "email/jane_doe",
    "email": "jane.doe@example.com",
    "roles": ["reviewer"],
    "createdBy": "email/admin_user",
    "createdByEmail": "admin@example.com",
    "newFields": {
      "email": "jane.doe@example.com",
      "fullname": "Jane Doe",
      "roles": ["reviewer"],
      "title": "Senior Engineer",
      "department": "Engineering",
      "employmentType": "full-time",
      "employmentStatus": "active",
      "manager": "email/manager",
      "startDate": "2022-01-15",
      "terminationDate": ""
    }
  }
]
```

{% endcode %}

### Step 6: Create the custom table

1. Open your Log Analytics workspace `law-balkanid`.
2. In the left menu, select **Settings → Tables**.
3. Select **Create → New custom log (DCR-based)**.
4. On the **Basics** tab, enter the following:

   * **Table name:** `BalkanIDUsers`. Azure adds the `_CL` suffix.
   * **Description:** optional, for example `BalkanID webhook user events`
   * **Table plan:** **Analytics**. Microsoft describes this plan as suited to continuous monitoring and latency-sensitive analysis ([Configure a table plan](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-table-plans)).

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2F3Y6wyizYURF959gRe1z3%2Fimage.png?alt=media&#x26;token=2d2209ff-23bd-4cb6-9efa-0c8a933aa0b0" alt="Create a custom log Basics tab with the table name BalkanIDUsers, a description, and the Analytics table plan selected."><figcaption><p>Table details on the Basics tab</p></figcaption></figure></div>

   * **Data collection rule:** select **Create a new data collection rule**, enter `dcr-balkanid-users`, select your subscription and resource group, and then select **Done**.

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2Fb95hRAi07Q0pgq0cTGDe%2Fimage.png?alt=media&#x26;token=597663d2-8cc0-46e4-afa0-e26286f561f9" alt="Create a data collection rule panel with the rule name dcr-balkanid-users, subscription, and resource group."><figcaption><p>Creating the data collection rule</p></figcaption></figure></div>

   * **Data collection endpoint:** select `dce-balkanid`.
5. Select **Next**.
6. On the **Schema and transformation** tab, select **Upload sample file**, and then select `user.created.json`.
7. Azure reports that the sample has no `TimeGenerated` column. Every Log Analytics table requires one ([Tutorial: Send data with the Logs Ingestion API](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-logs-ingestion-portal#parse-and-filter-sample-data)). Select **Transformation editor**.
8. Replace the query with the following, and then select **Run**:

```kusto
source
| extend TimeGenerated = now()
```

9. Confirm that a **TimeGenerated** column appears in the preview, and then select **Apply**.

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FYO4p5WaStINtxVosrj4v%2Fimage.png?alt=media&#x26;token=0b8f531f-aef7-4538-96c8-a0e4be5bbbda" alt="Transformation editor with the query source | extend TimeGenerated = now(), and a preview that includes the TimeGenerated column."><figcaption><p>Adding the TimeGenerated column in the transformation editor</p></figcaption></figure></div>
10. Select **Next**, and then select **Create**.
11. After a few minutes, refresh the page and confirm that **BalkanIDUsers\_CL** appears in the **Tables** list with the type **Custom table**.

    <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FVZPj0y8OWbC5SCScMcWc%2Fimage.png?alt=media&#x26;token=146276f5-69de-4e8f-b77a-3b758ddc5d82" alt="Tables list in the Log Analytics workspace showing BalkanIDUsers_CL with the type Custom table and the Analytics plan."><figcaption><p>The new custom table in the Tables list</p></figcaption></figure></div>

### Step 7: Build the ingestion URL

The Logs Ingestion API URL uses the format `{endpoint}/dataCollectionRules/{dcrImmutableId}/streams/{streamName}?api-version={apiVersion}` ([Logs Ingestion API: URI](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-ingestion-api-overview#uri)). Collect the following three values.

**Value 1: Logs ingestion endpoint**

1. Search for **Data collection endpoints** and select `dce-balkanid`.
2. On the **Overview** page, copy the **Logs Ingestion** value, for example `https://dce-balkanid-abcd.eastus-1.ingest.monitor.azure.com`.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2Fg3Da2bJPULvPcdheKbUi%2Fimage.png?alt=media&#x26;token=1822a5bf-e4fc-417f-beb9-e1495ae09f7d" alt="Data collection endpoint Overview page with the Logs Ingestion URL highlighted."><figcaption><p>Logs Ingestion URL on the data collection endpoint</p></figcaption></figure></div>

**Value 2: Data collection rule immutable ID**

1. Search for **Data collection rules** and select `dcr-balkanid-users`.
2. On the **Overview** page, select **JSON View**.
3. Copy the value of `"immutableId"`. It starts with `dcr-`.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FR7ZuZ9CYW7Ebj0aZCse5%2Fimage.png?alt=media&#x26;token=4dc0ddc5-8562-413b-87d3-9fef1c183384" alt="Data collection rule JSON view with the immutableId value, which starts with dcr-, highlighted."><figcaption><p>Immutable ID in the data collection rule JSON view</p></figcaption></figure></div>

**Value 3: Stream name**

1. In the same **JSON View**, find `"streamDeclarations"`.
2. Copy the name directly under it, for example `Custom-BalkanIDUsers_CL`. The stream name is `Custom-` followed by your table name, including the `_CL` suffix.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FsUd8pBhq0tPlZCJ5vAZk%2Fimage.png?alt=media&#x26;token=be01095b-b3f2-4a47-807f-6da77dab9715" alt="Data collection rule JSON view with the streamDeclarations section and the stream name Custom-BalkanIDUsers_CL highlighted."><figcaption><p>Stream name in the data collection rule JSON view</p></figcaption></figure></div>

**Combine the values**

Insert the three values into the following template. Don't add spaces, and don't include a trailing `/` :

```
<value 1>/dataCollectionRules/<value 2>/streams/<value 3>?api-version=2023-01-01
```

Example:

```
https://dce-balkanid-abcd.eastus-1.ingest.monitor.azure.com/dataCollectionRules/dcr-0123456789abcdef0123456789abcdef/streams/Custom-BalkanIDUsers_CL?api-version=2023-01-01
```

You use this URL in Step 10.

{% hint style="danger" %}
Don't enter this URL in BalkanID. In BalkanID, you enter the Logic App's trigger URL (Step 11), and the Logic App forwards events to this URL.
{% endhint %}

### Step 8: Create the Logic App

1. Search for **Logic apps** and select it.
2. Select **Add**.
3. Under **Consumption**, select **Multi-tenant**, and then select **Select**.
4. Enter the following:
   * **Subscription:** your subscription
   * **Resource Group:** `rg-balkanid-sentinel`
   * **Logic App name:** `la-balkanid-to-sentinel`
   * **Region:** your region
   * **Enable log analytics:** **No**
   * **Workflow Type:** **Stateful**
5. Select **Review + create**, and then select **Create**.
6. When deployment finishes, select **Go to resource**.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FXgcvuHefLlrqY8XnnfKi%2Fimage.png?alt=media&#x26;token=c74e1345-7d7e-4a9e-b823-8dac5acc6f92" alt="Create Logic App (Multi-tenant) form with the subscription, resource group, name, region, log analytics set to No, and the Stateful workflow type."><figcaption><p>Creating the Consumption Logic App</p></figcaption></figure></div>

{% hint style="info" %}
**Pricing:** Consumption Logic Apps follow a pay-for-what-you-use model. Beyond an initial number of free built-in operations per subscription, each operation execution is metered and billed. See [Usage metering, billing, and pricing for Azure Logic Apps](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-pricing#consumption-multitenant) and [Azure Logic Apps pricing](https://azure.microsoft.com/pricing/details/logic-apps/) for current rates.
{% endhint %}

### Step 9: Grant the Logic App access to the data collection rule

The Logic App uses a system-assigned managed identity to authenticate to the Logs Ingestion API. The identity needs the **Monitoring Metrics Publisher** role, which grants the permission that the Logs Ingestion API requires ([Tutorial: Assign permissions to the DCR](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-logs-ingestion-portal#assign-permissions-to-the-dcr)).

**Turn on the managed identity**

1. In the Logic App's left menu, select **Settings → Identity**.
2. On the **System assigned** tab, set **Status** to **On**.
3. Select **Save**, and then select **Yes**.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FZ0KUSifyFU4cb9qBSpFr%2Fimage.png?alt=media&#x26;token=e3c95f95-8d30-4503-9b16-fd047ba3ec2a" alt="Logic App Identity page on the System assigned tab with Status set to On and an Object (principal) ID shown."><figcaption><p>Turning on the system-assigned managed identity</p></figcaption></figure></div>

**Assign the role**

1. On the same page, select **Azure role assignments**.
2. Select **Add role assignment**, and enter the following:
   * **Scope:** **Resource group**
   * **Subscription:** your subscription
   * **Resource group:** `rg-balkanid-sentinel`
   * **Role:** **Monitoring Metrics Publisher**
3. Select **Save**.

<div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FnCBh81tHucnQE5iLljgf%2Fimage.png?alt=media&#x26;token=299db1a7-c6e7-4de1-8a97-e62edfab08a2" alt="Add role assignment panel with the scope set to the resource group and the Monitoring Metrics Publisher role selected."><figcaption><p>Assigning the Monitoring Metrics Publisher role</p></figcaption></figure></div>

{% hint style="info" %}
Allow up to 30 minutes for the role assignment to take effect. Until then, requests might return **403 Forbidden** ([Tutorial: Assign permissions to the DCR](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-logs-ingestion-portal#assign-permissions-to-the-dcr)).
{% endhint %}

### Step 10: Build the Logic App workflow

The workflow has two parts: a **trigger** that receives events from BalkanID, and an **HTTP action** that forwards them to the Logs Ingestion API.

1. In the Logic App's left menu, select **Development Tools → Logic app designer**.

**Add the trigger**

2. Select **Add a trigger**, search for **Request**, and select **When a HTTP request is received**.
3. Leave the trigger's settings at their defaults.

**Add the HTTP action**

4. Under the trigger, select **+ → Add an action**.
5. Search for **HTTP** and select **HTTP**.
6. Enter the following:

   * **URI:** the ingestion URL from Step 7
   * **Method:** **POST**
   * **Headers:** `Content-Type` with the value `application/json`

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2F2grTt6E27ImOdJSk158W%2Fimage.png?alt=media&#x26;token=339d1237-8e8f-41ef-b56d-fb49f8c4c674" alt="HTTP action parameters with the ingestion URL in URI, POST as the method, and a Content-Type header set to application/json."><figcaption><p>HTTP action URI, method, and headers</p></figcaption></figure></div>
7. Set the **Body** to an expression that wraps the incoming event in a JSON array, as the Logs Ingestion API requires:

   1. Select the **Body** field.
   2. Select the **fx** (expression) button.
   3. Enter `createArray(triggerBody())` in the expression box at the top of the panel.
   4. Select **Add**.

   The **Body** field now shows a **createArray(...)** token.

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FVezC4O7Mhw0ZMzCxtvDG%2Fimage.png?alt=media&#x26;token=7fb40c8b-0328-42d5-aad4-aa4edf536d8f" alt="Expression editor panel with createArray(triggerBody()) entered in the expression box."><figcaption><p>Entering the Body expression</p></figcaption></figure></div>
8. Under **Advanced parameters**, add **Authentication**, and enter the following:

   * **Authentication type:** **Managed identity**
   * **Managed identity:** **System-assigned managed identity**
   * **Audience:** `https://monitor.azure.com`, the token audience for the Azure public cloud ([Logs Ingestion API: Request headers](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-ingestion-api-overview#request-headers))

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2Fz2q2g0AMEd168aRkMxBA%2Fimage.png?alt=media&#x26;token=d6df8c58-e17b-4df9-9494-2b8123159b49" alt="HTTP action Authentication section with Managed identity, System-assigned managed identity, and the audience https://monitor.azure.com."><figcaption><p>Managed identity authentication on the HTTP action</p></figcaption></figure></div>
9. Open the HTTP action's **Settings** tab, and under **Content transfer**, set **Allow chunking** to **Off**. HTTP action chunking uses a Logic Apps–specific protocol that the receiving service must implement ([Handle large messages with chunking](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-handle-large-messages)).

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2F0PUAL4MtFDmgZLY5p2gr%2Fimage.png?alt=media&#x26;token=6428207c-aa35-4b80-a155-42a6edf4e30b" alt="HTTP action Settings tab with Allow chunking under Content transfer set to Off."><figcaption><p>Turning off chunking on the HTTP action</p></figcaption></figure></div>
10. Save the workflow. If the designer shows **Publish** instead of **Save**, select **Publish**. Changes take effect only after you publish.

**Copy the trigger URL**

11. Select the **When a HTTP request is received** trigger.
12. Copy the **HTTP URL**.

    <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FucDJ9zRMYlzyOyzJdSuK%2Fimage.png?alt=media&#x26;token=7b28bd8d-027a-40f1-af47-46e7e16a788a" alt="When a HTTP request is received trigger panel with the HTTP URL field and its copy button."><figcaption><p>Copying the trigger's HTTP URL</p></figcaption></figure></div>

{% hint style="danger" %}
The trigger URL includes a Shared Access Signature (SAS). Anyone with a URL that contains a valid key can trigger the workflow ([Secure access and data in Azure Logic Apps](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-securing-a-logic-app)). Store it as a secret and share it only with BalkanID. See [Security notes](#security-notes).
{% endhint %}

### Step 11: Create the webhook destination in BalkanID

1. In BalkanID, go to **Configure → Webhooks**.
2. On the **Destinations** tab, select **Add Destination**.
3. Select **Webhook**.
4. Enter the following:
   * **Name:** a descriptive name, for example `Microsoft Sentinel`
   * **Topics:** `user.created`
   * **Webhook URL:** the Logic App's HTTP URL from Step 10
   * **Custom Headers:** leave empty
5. Select **Create Destination**.

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FWwGQlFiUGs39SdwFkbYP%2Fimage.png?alt=media&#x26;token=93cb5985-7065-4e08-8fd1-ba46f8dbac09" alt="BalkanID Configure Webhook panel with a destination name and the user.created topic selected."><figcaption><p>Configuring the webhook destination in BalkanID</p></figcaption></figure></div>

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2Fuu399QO992J6mlraNxfl%2Fimage.png?alt=media&#x26;token=cb7f4cdf-1f6f-4c1f-9834-77dabf7ac6d8" alt="BalkanID Configure Webhook panel with the Logic App HTTP URL entered in the Webhook URL field and Custom Headers left empty."><figcaption><p>Entering the Logic App URL as the Webhook URL</p></figcaption></figure></div>

### Step 12: Send a test event

**Trigger an event**

1. In BalkanID, add a test user, for example `sentinel-test@example.com`. This sends a `user.created` event.

**Check the delivery in BalkanID**

2. Go to **Configure → Webhooks** and open the **Deliveries** tab. Confirm that the latest delivery shows **Success**.

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FaaVfMWZgHl7aRQuk5unz%2Fimage.png?alt=media&#x26;token=3fe58cfe-5f53-4047-b59f-fdccc1567b65" alt="BalkanID Webhooks Deliveries tab showing a delivery to the Microsoft Sentinel destination with the status Success."><figcaption><p>A successful delivery in BalkanID</p></figcaption></figure></div>

**Check the Logic App run**

3. In the Azure portal, open the Logic App and select **Run history**.
4. Select the latest run, and confirm that its status is **Succeeded**.
5. Select the **HTTP** action, and confirm that the **Status code** is **204**, which means the Logs Ingestion API accepted the event.

   <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2FFofRkuoJcDJH9VzBvnZ7%2Fimage.png?alt=media&#x26;token=8ce85c33-f4d3-47ba-8efa-ed95e6aae1ec" alt="Logic App run details with the HTTP action outputs showing status code 204."><figcaption><p>HTTP action status code in the Logic App run history</p></figcaption></figure></div>

**Query the table**

6. Open the Log Analytics workspace and select **Logs**.
7. If a chat panel opens instead of the query editor, turn off the **Agent** toggle.
8. Select **KQL mode**.
9. Set **Time range** to **Last 24 hours**, enter the following query, and select **Run**:

```kusto
BalkanIDUsers_CL
| order by TimeGenerated desc
| take 10
```

10. Confirm that the results include a row with the test user's email address.

    <div data-with-frame="true"><figure><img src="https://2975852473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbVGYwk8aSk5yI1GDPEW9%2Fuploads%2Ffrip0eYQEk8ljdYTSZoS%2Fimage.png?alt=media&#x26;token=cd4d95cd-d053-43dd-ba58-9de67c81e2a6" alt="Log Analytics Logs page in KQL mode with the BalkanIDUsers_CL query and a result row containing TimeGenerated, createdBy, createdByEmail, and email."><figcaption><p>The BalkanID event in the Log Analytics query results</p></figcaption></figure></div>

{% hint style="info" %}
The first event sent to a new table can take longer to appear, because Azure creates dedicated storage the first time a new custom data type arrives ([Log data ingestion time in Azure Monitor](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/data-ingestion-time#new-custom-data-types-provisioning)). If the query returns no results, wait a few minutes and run it again.
{% endhint %}

### Step 13: View the events in Microsoft Sentinel

You enable Microsoft Sentinel by adding it to a Log Analytics workspace ([Onboard to Microsoft Sentinel](https://learn.microsoft.com/en-us/azure/sentinel/quickstart-onboard#add-microsoft-sentinel-to-your-log-analytics-workspace)). After you add it to `law-balkanid`, you can query `BalkanIDUsers_CL` from Microsoft Sentinel.

{% hint style="warning" %}
Microsoft Sentinel is a paid service. Review the [Microsoft Sentinel pricing page](https://azure.microsoft.com/pricing/details/azure-sentinel/) before you add it to a workspace.
{% endhint %}

If Microsoft Sentinel is already added to `law-balkanid`, skip to step 4.

1. In the Azure portal, search for **Microsoft Sentinel** and select it.
2. Select **Create**.
3. Select `law-balkanid`, and then select **Add**.
4. Open Microsoft Sentinel for `law-balkanid`, and select **Logs**.
5. Run the query from Step 12:

```kusto
BalkanIDUsers_CL
| order by TimeGenerated desc
| take 10
```

Confirm that the same BalkanID event appears in the results.

### Security notes

* **Rotate the trigger URL periodically.** Regenerating the Logic App's access key under **Settings → Access keys** invalidates the old trigger URL ([Regenerate access keys](https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-securing-a-logic-app#regenerate-access-keys)). After you regenerate it, copy the new **HTTP URL** from the trigger and update the **Webhook URL** on your BalkanID destination.
* **Accept only events from BalkanID.** BalkanID signs every webhook request. To reject requests that don't come from BalkanID, verify the signature in your Logic App. See [Signature verification](https://docs.balkan.id/playbooks/outbound-webhooks.md#signature-verification).

### Troubleshooting

| Symptom                                                  | Resolution                                                                                                                                                                                                                                                        |
| -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *"The subscription is not registered to use namespace…"* | Register the resource provider (Step 1), wait until it shows **Registered**, and try again.                                                                                                                                                                       |
| BalkanID delivery fails with **404**                     | Confirm that the **Webhook URL** in BalkanID is the Logic App's HTTP URL from Step 10, not the ingestion URL from Step 7.                                                                                                                                         |
| HTTP action returns **403**                              | The Monitoring Metrics Publisher role assignment (Step 9) isn't active yet or is missing. Allow up to 30 minutes, and then send another test event.                                                                                                               |
| HTTP action returns **404**                              | The immutable ID or stream name in the ingestion URL is incorrect ([Tutorial: Troubleshoot common issues](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-logs-ingestion-portal#troubleshoot-common-issues)). Recheck the values from Step 7. |
| HTTP action fails with another error                     | Confirm that the **Body** shows **createArray(...)**, and that **Allow chunking** is **Off** (Step 10).                                                                                                                                                           |
| The query returns no results                             | Wait a few minutes after the first event and run the query again. Confirm that **Time range** covers the time of the event.                                                                                                                                       |
| Workflow changes have no effect                          | If the designer shows a **Publish** button, select it.                                                                                                                                                                                                            |

## Related pages

* [Outbound Webhooks](https://docs.balkan.id/playbooks/outbound-webhooks.md)
* [Events and Deliveries](https://docs.balkan.id/playbooks/outbound-webhooks/events-and-deliveries.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.balkan.id/playbooks/outbound-webhooks/microsoft-sentinel-via-logic-apps.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
