Skip to content

Ingesting audit events to Microsoft Sentinel via Azure Logic App

Overview

This guide explains how to configure Afi to send audit events to Microsoft Sentinel through an Azure Logic App webhook.

What Afi Sends

Architecture

Components

Component Role
Afi Sends audit events via webhook
Logic App Processes incoming webhooks and forwards data to Data collection endpoint
Data collection endpoint/DCE Receives data from Logic App for ingestion
Data collection rule/DCR Parses incoming data and applies transformations
Log Analytics workspace Stores ingested data for analysis and queries
Microsoft Sentinel SIEM platform for security analysis and response

Prerequisites

  • Azure subscription
  • Azure account with Owner, User Access Administrator, or Role-Based Access Control Administrator permissions
  • Afi organization administrator account

Part 1: Create Log Analytics workspace and enable Microsoft Sentinel

  1. In Azure Portal, search for Microsoft Sentinel and open it.
  2. Click + Create.
  3. Click + Create a new workspace.

  4. Fill in:

    • Subscription: Your subscription
    • Resource Group: Click Create new and enter a name (e.g., resource-group-afi-sentinel)
    • Name: Enter a workspace name (e.g., logaw-afi-sentinel)
    • Region: Your preferred region (e.g., East US)

    Info

    If you already have Microsoft Sentinel with an existing Log Analytics workspace, you can skip creating new resources and use your existing ones. Adjust the resource names in the following steps accordingly.

  5. Click Review + CreateCreate. Wait for deployment to complete — you should see Your deployment is complete.

  6. Go back to Microsoft Sentinel and click + Create.

  7. Select your workspace from the list (e.g., logaw-afi-sentinel) and click Add.

Part 2: Create Data collection endpoint

Step 1 - Create Data collection endpoint

  1. In Azure Portal, search for Data collection endpoints and open it.
  2. Click + Create.

  3. Fill in:

    • Endpoint Name: Enter a name (e.g., dcendpoint-afi-sentinel)
    • Subscription: Your subscription
    • Resource Group: Select your resource group (e.g., resource-group-afi-sentinel)
    • Region: Same as your Log Analytics workspace (e.g., East US)

  4. Click Review + CreateCreate. The new endpoint will appear in the Data collection endpoints list.

Step 2 - Get Data collection endpoint Logs Ingestion URI

  1. Open your endpoint (e.g., dcendpoint-afi-sentinel).
  2. Go to Overview.
  3. Copy Logs Ingestion:
    dce-afi-logs-xxxx.eastus-1.ingest.monitor.azure.com
    
  4. Save this for later — you'll need it to build the URI in the "HTTP" action step.


Part 3: Create Data collection rule and Custom Table

Step 1 - Create Data collection rule and define Custom Table

  1. Go to Log Analytics workspaces and open your workspace (e.g., logaw-afi-sentinel).

  2. In the left menu, navigate to SettingsTables.

  3. Click + Create to open the creation wizard.

Basic Tab

  1. Set Table name: AfiSentinelAuditLogs.

  2. For Data collection rule, click Create a new data collection rule:

    • Subscription: Your subscription
    • Resource group: resource-group-afi-sentinel
    • Region: Same as your Log Analytics workspace (e.g., East US)
    • Name: dcrule-afi-sentinel
    • Click Done.
  3. For Data collection endpoint, select dcendpoint-afi-sentinel.
  4. Click Next.

Schema Tab

  1. Create a file afi-sample.json with the following content:

    {
       "Action": "browse",
       "Actor": "JohnDoe",
       "ActorID": "JohnDoe",
       "ActorIP": "JohnDoe",
       "ActorName": "JohnDoe",
       "Details": {
          "content_preview": true
       },
       "EventID": "JohnDoe",
       "Location": "JohnDoe",
       "Subject": "JohnDoe",
       "SubjectID": "JohnDoe",
       "SubjectKind": "JohnDoe",
       "TenantID": "JohnDoe",
       "TenantName": "JohnDoe",
       "Time": "2026-04-21T12:40:21Z"
    }
    
  2. Upload the file. Azure Monitor Logs will auto-detect the columns from your JSON sample. You'll see an error about the TimeGenerated field — this is expected. Click Transformation editor to fix it.

  3. In the query editor, replace the default source query with:

    source
    | extend TimeGenerated = todatetime(Time)
    
  4. Click Run, then Apply.

    Info

    Azure Monitor Logs uses the TimeGenerated field for time-based filtering and summarization. Include it to preserve accurate event timestamps.

  5. Click NextCreate.

Step 2 - Get Data collection rule values

You'll need two values from the Data collection rule to configure the Logic App HTTP action.

  1. In Azure Portal, search for Data collection rules and open your rule (e.g., dcrule-afi-sentinel).
  2. Click JSON View in the top right corner to see the raw JSON configuration.

  3. Search (Ctrl+F) for and save this for later — you'll need it to build the URI in the "HTTP" action step:

    Property Example
    immutableId dcr-abc123def456...
    streams Custom-AfiSentinelAuditLogs_CL

    Note: Stream name is case-sensitive!


Part 4: Create Logic App

Step 1 - Create Logic App

  1. In Azure Portal, click Create a resource.

  2. Search for Logic App and select it.

  3. Click Create. For the hosting option, select Consumption (pay-per-execution, suitable for this integration).

  4. Fill in:

    • Subscription: Your subscription
    • Resource Group: Select your resource group (e.g., resource-group-afi-sentinel)
    • Name: Enter a name (e.g., logic-app-afi-sentinel)
    • Region: Same as your Log Analytics workspace (e.g., East US)

  5. Click Review + CreateCreate. Wait for deployment — you should see Your deployment is complete.

  6. Click Go to resource to open the Logic App.

Step 2 - Enable Managed Identity in Logic App

  1. Go to SettingsIdentity.
  2. Set System assigned status to On.
  3. Click Save and confirm with Yes.

Step 3 - Assign Permissions (RBAC) to Logic App

Assign the Monitoring Metrics Publisher role to the Logic App on the Data collection rule to authorize data ingestion via managed identity without storing API keys.

  1. In Azure Portal, search for Data collection rules and open your rule (e.g., dcrule-afi-sentinel).
  2. In the left menu, go to Access control (IAM) → click + AddAdd role assignment.

  3. In the Role tab, search for and select Monitoring Metrics Publisher, then click Next.

  4. In the Members tab, configure:

    • Assign access to: Managed identity
    • Members: Click + Select members and choose:
      • Managed identity: Logic App
      • Select: Your Logic App (e.g., logic-app-afi-sentinel)

  5. Click Review + assign twice to complete the assignment.


Part 5: Configure Logic App Workflow

Logic App Workflow

Component Role
Trigger (When HTTP request is received) Receives audit events from Afi
Compose Wraps the event data in an array for the Logs Ingestion API
HTTP Sends data to the Data collection endpoint
  1. Open your Logic App (e.g., logic-app-afi-sentinel).
  2. In the left menu, go to Development ToolsLogic App Designer. This opens the visual workflow editor.

Step 1 - Create trigger When an HTTP request is received

This trigger creates a webhook URL that receives audit events from Afi.

  1. In the workflow editor click Add a trigger.
  2. Search for Request and select When an HTTP request is received.
  3. Leave the default settings and click Save.

  4. After saving, an HTTP URL is generated. Save this URL for later — you'll need it to configure the webhook on the Afi side.

Step 2 - Create action Compose

  1. Below the trigger in the workflow editor, click +Add an Action.
  2. Search for Compose and select it.

  3. Click the input field → click ⚡️ icon and choose Insert expression.

  4. Paste the following function:
    createArray(json(string(triggerBody()))['event'])
    
  5. Click Add, then Save.

    Info

    The Logs Ingestion API expects an array. This action wraps Afi's JSON body in an array.

Step 3 - Create action HTTP

  1. Below the action in the workflow editor, click +Add an Action.
  2. Search for HTTP and select it.

  3. Configure the following fields:

URI: Build using your saved values:

https://<DCE-LOGS-INGESTION-URI>/dataCollectionRules/<DCR-IMMUTABLE-ID>/streams/<STREAM-NAME>?api-version=2023-01-01

Where:

Example:

https://dce-afi-logs-abc1.eastus-1.ingest.monitor.azure.com/dataCollectionRules/dcr-0123456789abcdef/streams/Custom-AfiSentinelAuditLogs_CL?api-version=2023-01-01

Method: POST

Headers:

Key Value
Content-Type application/json

Body: Click on the Body field, then click the ⚡️ icon and select Outputs.

Step 4 - Configure authentication in HTTP action

  1. Click Advanced parameters → select Authentication.
  2. Set Authentication type to Managed Identity.
  3. Configure:
Setting Value
Managed identity System-assigned managed identity
Audience https://monitor.azure.com
  1. Click Save.


Part 6: Configure Webhook on the Afi-side

Go to ConfigurationSIEM tab to create a channel with the following parameters:


Part 7: Test integration

Step 1 - Generate test audit event

Perform an auditable event on the Afi-side:

  • Browse a backup
  • Start a restore or export
  • Run a search query

Step 2 - Check Logic App

  1. Open your Logic App (e.g., logic-app-afi-sentinel) and go to OverviewRun history.
  2. Refresh the history. You should see a new run triggered by your test event.

  3. Verify that the run status is Succeeded. If it failed, click on the run to see error details.


Part 8: Check test audit events in Microsoft Sentinel

Finally, verify that Microsoft Sentinel has received the audit events.

  1. Open Microsoft Sentinel and select your workspace (e.g., logaw-afi-sentinel).
  2. In the left menu, go to GeneralLogs to open the query editor.

  3. Run the following query to see recent audit events:

    AfiSentinelAuditLogs_CL
    | sort by TimeGenerated desc
    | limit 10
    

  4. You should see your test audit events in the results.

    Info

    Initial data may take up to 15 minutes to appear in Microsoft Sentinel.


Optional: Review and Add Event Fields

After testing, you may find that some fields from Afi aren't appearing in Microsoft Sentinel, or that you want to remove fields you don't need. The initial sample used minimal fields to pass validation — you can now adjust the schema based on actual event data.

  1. Open your Logic App (e.g., logic-app-afi-sentinel) and go to OverviewRun history.
  2. A list of runs triggered by your test events should appear. Click on one to view details.
  3. Click the HTTP action to expand its details.
  4. Review the Body section — this shows all fields that Afi includes in webhook requests.

  5. To modify which fields appear in Microsoft Sentinel, update both the custom table schema and streamDeclarations in the Data collection rule.

Step 1 - Update custom table schema

  1. Go to Log Analytics workspaces and open your workspace (e.g., logaw-afi-sentinel).
  2. In the left menu, navigate to SettingsTables.
  3. Click ... on AfiSentinelAuditLogs_CLEdit schema.

  4. Add or remove fields as needed, then click Save.

Step 2 - Update streamDeclarations in the Data collection rule

  1. In Azure Portal, open Cloud Shell (top right >_ icon) and select Bash.
  2. Run:
az monitor data-collection rule show \
  --name "dcrule-afi-sentinel" \
  --resource-group "resource-group-afi-sentinel" \
  -o json > dcr-current.json
  1. Click Manage filesDownload and enter the filename dcr-current.json.
  2. Edit the file locally, adding the same fields to streamDeclarations:
    "streamDeclarations": {
        "Custom-AfiSentinelAuditLogs_CL": {
           "columns": // you need to add them here
        }
    }
    
  3. Click Manage filesUpload and select the updated dcr-current.json.
  4. Run:
az monitor data-collection rule create \
  --name "dcrule-afi-sentinel" \
  --resource-group "resource-group-afi-sentinel" \
  --rule-file dcr-current.json
  1. Verify the update by opening JSON View in your Data collection rule.

Info

The custom table schema and Data collection rule are separate and do not sync automatically.

Step 3 - Check test audit events in Microsoft Sentinel

Check that your field changes appear correctly in Microsoft Sentinel.