Event Grid Reactive Webhook Router
An HTTP-triggered flow that receives Azure Event Grid events (including the subscription validation handshake), routes each event by its eventType to the right downstream action, and fans notifications to Teams. Handles the SubscriptionValidationEvent so the Event Grid subscription can be created against the flow URL.
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
The FlowLibs - Event Grid Reactive Webhook Router turns a Power Automate cloud flow into a first-class Azure Event Grid event handler. Event Grid delivers events over an HTTP webhook, and this flow's built-in When a HTTP request is received trigger is that webhook endpoint. The flow handles the one-time Event Grid subscription-validation handshake (echoing the validationCode so Event Grid accepts the endpoint), then routes each delivered event by its eventType to a tailored Microsoft Teams notification, writes an audit record to Dataverse, and optionally forwards the raw event to a downstream webhook.
Why it matters: Event Grid is the backbone of reactive Azure architectures (blob created, resource deployed, custom topic published). Wiring it to Power Automate lets business workflows react to infrastructure events in near real time — without polling — from a single declarative routing point.
Status: Built — ships Off (demo). Going live requires only authorizing the Teams + Dataverse connections, setting the environment-variable values, and registering the trigger URL as an Event Grid subscription endpoint. Flow Checker: 0 errors / 0 warnings.
Use Case
A platform team wants near-real-time Teams notifications (and downstream automation) whenever specific Azure events fire — a blob lands, a resource group changes, or a custom app publishes a domain event — with one declarative routing point they can extend per event type, plus a durable audit trail in Dataverse.
Flow Architecture
When a HTTP Request Is Received
Request (built-in)Public webhook URL that Event Grid posts the event array to.
Initialize correlation id + routing config
Initialize VariableTrace id plus env-var-bound config (Teams group/channel, downstream URL, log table) and per-event routing holders.
Check If Subscription Validation
ConditionIs this the Microsoft.EventGrid.SubscriptionValidationEvent handshake?
Respond With Validation Code + Terminate
Response + TerminateOn the handshake, echo validationResponse = the validation code (200) and end the run cleanly.
For Each Event
Apply to each (concurrency 1)Event Grid delivers an array — process each event in order.
Switch On Event Type
SwitchRoute by eventType (BlobCreated, ResourceWriteSuccess, ResourceDeleteSuccess, default Custom/Unrouted); each branch builds the tailored Teams message + routing category.
Post Event To Teams
Microsoft Teams — PostMessageToConversationPer-event human notification to the target channel.
Log Event To Dataverse
Microsoft Dataverse — CreateRecordCompose the audit row as one object and write it to the audit table (whole-object bind).
Forward Event Downstream
Condition → HTTPForward the raw event to the downstream webhook when one is configured.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TeamsGroupId | String | <your-team-id> | Target Teams team/group id for notifications. |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Target Teams channel id. |
| flowlibs_DownstreamWebhookUrl | String | — | Optional downstream webhook to forward routed events to; blank disables forwarding. |
| flowlibs_EventLogTableName | String | flowlibs_eventgridevents | Dataverse audit-table entity set name (reference; surfaced in the ack response). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| HTTP | http | When a HTTP request is received Response Terminate HTTP |
| Microsoft Teams | shared_teams | 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.
- Add event types
- Add a Switch case per new eventType (e.g. Microsoft.Resources.ResourceActionSuccess, a custom-topic event) with its own message + category.
- CloudEvents schema
- If the topic uses CloudEvents v1.0 instead of the Event Grid schema, validation is a GET handshake with a WebHook-Request-Origin header; branch on triggerOutputs()?['headers'] rather than the body validationCode.
- Downstream fan-out
- Set flowlibs_DownstreamWebhookUrl to forward routed events; extend the forward branch to target per-category endpoints.
- Security
- Validate a shared-secret query-string parameter on the trigger URL (compare against an env-var secret) before processing.
- Reporting
- Build a Power BI report or model-driven view over the flowlibs_eventgridevent table for event-volume and routing analytics.
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.01Detect the handshake
Is the first payload item the subscription-validation event?
EXPR.02Echo the validation code
Return the validation code in validationResponse.
EXPR.03Switch expression
Route each event by its eventType.
EXPR.04Whole-object audit-row bind
Bind the whole audit row as one Compose object.
EXPR.05Acknowledged event count
Count of events processed in the batch.
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.