Event Grid Dead-Letter Reprocessing
On a schedule (and on a dead-letter blob event), the flow reads Event Grid dead-lettered events from the dead-letter Blob container, attempts reprocessing through the original topic, and on repeated failure alerts engineering in Teams with the payload. Provides resilient recovery for failed Event Grid deliveries.
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 solution provides resilient recovery for failed Azure Event Grid deliveries. When Event Grid exhausts its own delivery retries, it dead-letters the undeliverable events to a Blob Storage container - where they are typically forgotten. This solution automatically picks them up, republishes them to the original topic (reprocessing), archives the handled blob, and escalates persistent failures to engineering in Microsoft Teams with the payload.
It ships as one solution containing two cooperating flows: an Event Trigger flow that fires the moment a dead-letter blob is written, and a Scheduled Sweep flow that hourly lists the container and reprocesses anything the event-driven flow missed.
Both flows ship Off (demo).
Use Case
An event-driven system (Event Grid topics/subscriptions feeding webhooks, Functions, Logic Apps, etc.) needs a safety net for events that failed delivery. Rather than silently losing dead-lettered events, this solution recovers them automatically and surfaces the ones that genuinely cannot be recovered so engineers can intervene with the full payload in hand.
Flow Architecture
When A Dead-Letter Blob Is Created (Flow 1)
Azure Event Grid - CreateSubscription (webhook)Subscribes to Microsoft.Storage.BlobCreated on the dead-letter storage account; splitOn runs each blob independently.
Run Hourly Dead-Letter Sweep (Flow 2)
Recurrence (1 hour)Periodic safety-net sweep that lists the dead-letter container and reprocesses anything missed.
Read & Parse Dead-Letter Payload
Azure Blob Storage - GetFileContentByPath_V2 + Parse JSONReads the dead-letter blob (JSON array of events), types the events, and reads the batch delivery-attempt count.
Retries Exhausted?
ConditionAt/above max attempts, escalate without retry; otherwise reprocess.
Reprocess (Republish)
HTTP - POST to Event Grid topicRebuilds clean Event Grid events and republishes to the topic with the aeg-sas-key header.
Archive or Escalate
Azure Blob Storage - CopyFile_V2/DeleteFile_V2 + Microsoft TeamsOn success archives the blob to the reprocessed container and confirms in Teams; on failure/exhaustion moves it to the failed container and escalates with the HTTP status.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_StorageAccount | String | flowlibsstorage | Storage account hosting the dead-letter container (Blob dataset). |
| flowlibs_DeadLetterContainer | String | deadletter | Dead-letter container being monitored. |
| flowlibs_ReprocessedContainer | String | eventgrid-reprocessed | Archive container for successfully reprocessed blobs. |
| flowlibs_FailedContainer | String | eventgrid-failed | Container for blobs that failed or exhausted retries. |
| flowlibs_MaxDeliveryAttempts | String | 5 | At/above this delivery-attempt count, escalate instead of reprocess. |
| flowlibs_EventGridTopicEndpoint | String | https://your-topic.eastus-1.eventgrid.azure.net/api/events | Original Event Grid topic endpoint to republish to. |
| flowlibs_EventGridTopicKey | String | <configure> | Topic SAS key sent as the aeg-sas-key header (store in Key Vault for production). |
| flowlibs_EventGridSubscriptionId | String | <your-subscription-id> | Azure subscription id for the Event Grid trigger scope (Flow 1). |
| flowlibs_DeadLetterStorageTopic |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Azure Event Grid | shared_azureeventgrid | CreateSubscription (trigger) |
| Azure Blob Storage | shared_azureblob | GetFileContentByPath_V2 ListFolder_V4 CopyFile_V2 DeleteFile_V2 |
| HTTP | http | POST republish to Event Grid topic |
| 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.
- Reprocess target
- Republishing to the topic re-delivers to all subscribers. To replay to a single handler, point the republish action at the handler's endpoint.
- Exhaustion policy
- Tune the max delivery attempts, or add exponential backoff before re-republishing.
- Sweep cadence
- Change the Recurrence on the sweep flow (default hourly).
- Audit trail
- Add a Dataverse CreateRecord alongside each Teams notification to persist a reprocessing log keyed on the correlation id.
- Metrics
- Track dead-letter container depth over time from the ListFolder_V4 output.
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.01In-scope check
Only processes blobs in the monitored dead-letter container.
EXPR.02Delivery attempts
Reads the batch delivery-attempt count across payload shapes.
EXPR.03Retries exhausted
Escalate-vs-reprocess decision.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.