Skip to main content

Architecture

The Logic App acts as a thin translation layer: it validates the HMAC signature, maps the Cognisafe JSON payload to the CognisafeThreatEvents_CL schema, and forwards to the Log Analytics Data Collector API. No custom code deployment is required — all logic lives in the Logic App definition.
This integration uses the classic Log Analytics Data Collector API (HTTP Data Collector) which is GA and broadly available. Microsoft’s newer DCE/DCR pipeline is also supported; see the Tip at the end of Step 3 if you prefer it.

Step 1: Create a Log Analytics Workspace


Step 2: Create the Custom Table

Custom log tables in Log Analytics end with _CL. The schema below matches the Cognisafe threat_detected webhook payload.
Once data flows in, you can add columns via Log Analytics → Tables → CognisafeThreatEvents_CL → Edit schema without re-creating the table.

Step 3: Logic App Webhook Receiver

Create the Logic App

Then replace the workflow definition with the ARM template below (deploy via portal Logic App Designer → Code view, or az deployment group create):
After deployment, copy the Logic App’s HTTP trigger URL from the Overview blade and paste it into Cognisafe Settings → Webhooks → Endpoint URL.
For the DCE/DCR pipeline (recommended for new workspaces in 2026+): replace the Send_to_Log_Analytics action with a call to your Data Collection Endpoint URL using a managed identity bearer token obtained from https://management.azure.com/ audience. The payload schema remains identical.

Step 4: Sentinel Analytics Rules

Create these rules in Microsoft Sentinel → Analytics → Create → Scheduled query rule.

Rule 1 — Critical Severity Spike

Fires when more than 5 critical events occur within any 10-minute window across a single project.
Rule settings:
  • Query frequency: every 5 minutes
  • Lookup period: 10 minutes
  • Alert threshold: results > 0
  • Incident grouping: group by ProjectId

Rule 2 — LLM01 Prompt Injection Detected

Fires on any single detection of prompt injection regardless of severity — zero tolerance.
Rule settings:
  • Query frequency: every 5 minutes
  • Lookup period: 5 minutes
  • Alert threshold: results > 0
  • Severity: High
  • Tactics: InitialAccess, Execution

Rule 3 — New Agent Name Appearing (Potential Rogue Agent)

Detects an AgentName that has not been seen in the previous 7 days — a signal that an unregistered or rogue agent is active.
Rule settings:
  • Query frequency: every 1 hour
  • Lookup period: 1 day
  • Alert threshold: results > 0
  • Severity: Medium
  • Tactics: Discovery, Persistence

Step 5: Sentinel Workbook

Create a new Workbook in Microsoft Sentinel → Workbooks → Add workbook and paste these query tiles.

Threats by OWASP Category (Pie Chart)

Visualisation: Pie chart, Label = OwaspCategory, Value = Count.

Threat Timeline (Line Chart)

Visualisation: Time chart, X = TimeGenerated, Y = Threats, Split = Severity.

Top Flagged Agents (Bar Chart)

Visualisation: Bar chart, X = AgentName, Y = TotalThreats.

Incident Enrichment

Add the Cognisafe RunId and ReportUrl to Sentinel incidents via a Playbook (Logic App triggered on incident creation):

RBAC

The Logic App’s system-assigned managed identity needs:
Do not assign Microsoft Sentinel Contributor to the Logic App identity. It only needs to write to Log Analytics, not to modify Sentinel configuration.