Sentinel MCP Analyst Q&A Bot
A Teams bot/flow lets analysts ask plain-language questions about their environment ("show failed logins for user X this week"), routes them to the Sentinel MCP (Preview) which generates and runs KQL, and returns formatted results with the query used. Provides conversational, governed access to Sentinel data.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
A Teams-triggered conversational bot that gives security analysts governed, plain-language access to Microsoft Sentinel. An analyst posts a natural-language question in a designated Teams channel (e.g. "show failed logins for user X this week"). The flow routes the question to the Microsoft Sentinel MCP (Preview) connector, which generates and runs KQL against the workspace, then posts the formatted answer back into Teams and writes a governed audit row to Dataverse.
Why it matters: Not every analyst writes KQL. This bridges the gap conversationally while logging every question, the generated query, and the requester for governance and audit.
Build status: Built via API-first deployment. Flow Checker 0 errors / 0 warnings. Ships Off (demo); going live requires only authorizing the three connections and setting the four environment-variable values.
Use Case
Security/SOC analysts want to interrogate Sentinel in natural language from within Teams, without writing KQL and without leaving their collaboration tool - while the security team retains a complete, governed record of who asked what and which query ran.
Flow Architecture
When a New Analyst Question Is Posted
Teams OnNewChannelMessage (polling 5 min, splitOn)Picks up each new message posted in the monitored Teams channel as a question
Initialize variables
InitializeVariableCorrelation id, question text, asker, source message id, MCP tool name, workspace id, protocol version, session id, client name/version
Open Mcp Session
Sentinel MCP invokemcpdataexploration (JSON-RPC initialize)Opens an MCP session; session id returned in the response header
Ask Sentinel Mcp
Sentinel MCP invokemcpdataexploration (JSON-RPC tools/call)Sends the question; MCP generates KQL, runs it, returns findings in result
Compose Teams Reply Html
ComposeBuilds the formatted HTML answer card (asker, question, answer, correlation id)
Post Answer To Teams
Teams PostMessageToConversationPosts the formatted answer back into the channel
Log Question And Answer
Dataverse CreateRecordWrites a governed audit row to the Sentinel Analyst Q&A Log table
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TeamsGroupId | String | <your-team-id> | The Teams team/group id of the monitored channel (trigger + reply) |
| flowlibs_TeamsChannelId | String | <your-channel-id> | The Teams channel id analysts post questions in |
| flowlibs_SentinelMcpToolName | String | run_hunting_query | The Sentinel MCP tool name invoked for NL->KQL |
| flowlibs_SentinelWorkspaceId | String | <configure> | The Sentinel / Log Analytics workspace id the KQL runs against |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Microsoft Sentinel MCP (Preview) | shared_sentinelmcp | invokemcpdataexploration |
| Microsoft Teams | shared_teams | OnNewChannelMessage PostMessageToConversation |
| Microsoft Dataverse | shared_commondataserviceforapps | CreateRecord |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Channel scope
- Point flowlibs_TeamsGroupId / flowlibs_TeamsChannelId at the SOC channel you want monitored. Trigger polls every 5 minutes (adjust the recurrence for lower latency).
- MCP tool
- Change flowlibs_SentinelMcpToolName to match the data-exploration / hunting tool exposed by your tenant's Sentinel MCP preview.
- Saved questions / RBAC
- Add a Condition before Ask Sentinel Mcp to allow only approved askers, or to map quick-pick prompts.
- Threaded replies
- Swap PostMessageToConversation for a reply op if you want answers threaded under the question using the captured varSourceMessageId.
- Richer audit
- Extend the flowlibs_sentinelqalog table (e.g. result row count, latency) and populate more item/ fields in Log Question And Answer.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Question (HTML-stripped)
Strips basic HTML wrappers from the posted message
EXPR.02Asker
Display name of the question author
EXPR.03MCP session id (from header)
Captures the session id from the handshake response header
EXPR.04tools/call body
queryRequest body with header Mcp-Session-Id: @variables('varMcpSessionId')
EXPR.05Answer (untyped result)
Normalizes the untyped MCP result with a fallback
EXPR.06Posted Teams message id
Id of the answer message posted to Teams
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.