Event Grid Media/IoT Event to Workflow
Subscribed to Event Grid events from Azure services (Media Services job finished, IoT Hub device telemetry/threshold, Maps geofence), the flow reacts in real time - publishing media, alerting on device anomalies, or dispatching field tasks - and logs the event. Bridges Azure platform events into business workflows.
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
This event-driven flow bridges Azure platform events into business workflows using Azure Event Grid. It subscribes (via a webhook Event Grid subscription) to Azure service events - Media Services job finished/errored, IoT Hub device telemetry/connection, and Azure Maps geofence - classifies each event, writes a full audit record to Dataverse, and notifies a Microsoft Teams channel, escalating critical events to a high-visibility alert.
Why it matters: platform events normally stay inside Azure. Routing them into Power Automate connects infrastructure signals to the people and processes that must react - publishing finished media, investigating device anomalies, or dispatching field tasks - while keeping a durable, queryable history of everything that happened.
Ships Off (demo).
Use Case
An Azure-native solution emits platform events (media processing, IoT device signals, mapping geofences) that need to drive business actions and be auditable. This flow gives event-driven, low-latency reaction instead of polling: every event is categorized (Media / IoT / Maps / Other), logged to Dataverse with a correlation id, and surfaced in Teams - with critical event types raising an on-call alert.
Flow Architecture
When a Platform Event Occurs
Azure Event Grid - CreateSubscription (webhook)Subscribes to subscription-scoped Event Grid events filtered to Media/IoT/Maps types; splitOn runs once per event.
Initialize Trace & Config
Initialize variableMints a correlation id and loads the critical-event list and Teams group/channel ids from env vars.
Classify Event
Set variableClassifies the event as Media / IoT / Maps / Other from the event-type prefix.
Log Event To Dataverse
Microsoft Dataverse - CreateRecordWrites type, subject, status, resource URI, category, correlation id, and raw payload to the EG Platform Event table.
Notify (Critical vs Info)
Condition + Microsoft Teams - PostMessageToConversationCritical event types post a high-visibility alert; everything else posts an informational confirmation.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_AzureSubscriptionId | String | <your-subscription-id> | Azure subscription for the Event Grid topic scope; also builds /subscriptions/{id}. |
| flowlibs_EventGridResourceType | String | Microsoft.Resources.Subscriptions | Resource provider type the subscription is scoped to. Change for a specific Media/IoT/Maps resource. |
| flowlibs_CriticalEventTypes | String | Microsoft.Media.JobErrored,Microsoft.Devices.DeviceDisconnected,Microsoft.Maps.GeofenceEntered | Comma-separated event types/keywords that raise a critical Teams alert. |
| flowlibs_TeamsGroupId | String | <your-team-id> | Teams team (group) id for notifications. |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Teams channel id for notifications. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Azure Event Grid | shared_azureeventgrid | CreateSubscription (trigger) |
| Microsoft Dataverse | shared_commondataserviceforapps | CreateRecord |
| Microsoft Teams | shared_teams | PostMessageToConversation |
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.
- Target a specific resource
- Set the Event Grid resource type and point the topic at a Media Services account, IoT Hub, or Maps account resource id; adjust includedEventTypes to that resource's events.
- Tune criticality
- Edit the critical event types list to control which event types escalate to the alert branch (no flow edit needed).
- IoT routing
- Extend the critical branch to map a device id to an owner and dispatch a task.
- Media publish
- In the Media branch, push finished assets to a CDN or site.
- Geofence dispatch
- In the Maps branch, look up the nearest technician and create a field task.
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.01Category
Derives the business category from the event-type prefix.
EXPR.02Criticality test
True when the event type is in the configured critical list.
EXPR.03Raw payload to log
Serializes the full event body for the audit row.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.