Azure DevOps Build Failed Escalation Email
When a build pipeline fails, email the committer and team lead with failure details, logs link, and a retry button.
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 Azure DevOps Build Failed Escalation Email flow monitors an Azure DevOps build pipeline on an hourly schedule. When failed builds are detected, it sends a richly formatted HTML escalation email to the team lead with build details, a direct link to the build logs, and a retry button — ensuring failed builds never go unnoticed.
Use Case
DevOps teams need immediate visibility when CI/CD pipelines fail. Manual monitoring of build dashboards is unreliable, especially outside business hours. This flow automates the detection-and-escalation loop so that the right people are notified within an hour of any failure, complete with actionable links to investigate and retry.
The flow is ideal for teams that:
- Developers
- DevOps engineers
- IT Admins
Flow Architecture
Recurrence - Check for Failed Builds
RecurrenceRuns every 1 hour to poll for new failed builds.
Initialize Variable - Organization Name
InitializeVariableLoads Azure DevOps org name from env var flowlibs_AzureDevOpsOrgName.
Initialize Variable - Project Name
InitializeVariableLoads project name from env var flowlibs_AzureDevOpsProject.
Initialize Variable - Build Definition ID
InitializeVariableLoads build definition ID from env var flowlibs_AzDoBuildDefinitionId.
Initialize Variable - Team Lead Email
InitializeVariableLoads escalation email from env var flowlibs_BuildFailureTeamLeadEmail.
List Failed Builds
OpenApiConnectionQueries Azure DevOps for the 10 most recent failed builds for the specified definition.
Check If Any Failed Builds Found
If conditionBranches based on whether failed builds were returned by the Azure DevOps query.
- Apply to Each Failed Build — For each failed build, build the email body and send it.
- Compose Email Body — Builds an HTML email with build number, definition name, requestor, source branch, timestamps, reason, and action buttons.
- Send Escalation Email to Team Lead — Sends High importance email via Office 365 Outlook with the composed HTML body.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_AzureDevOpsOrgName | String | <configure> | The Azure DevOps organization name (e.g., "contoso"). |
| flowlibs_AzureDevOpsProject | String | <configure> | The Azure DevOps project name to query builds from. |
| flowlibs_AzDoBuildDefinitionId | Number | 1 | The numeric ID of the build pipeline definition to monitor (find this in the pipeline URL). |
| flowlibs_BuildFailureTeamLeadEmail | String | teamlead@yourcompany.com | Email address of the team lead who receives failure alerts. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Azure DevOps | shared_visualstudioteamservices | ListBuilds (query failed builds) |
| Office 365 Outlook | shared_office365 | SendEmailV2 (send escalation emails) |
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.
- Import the solution
- Import the solution into your target environment.
- Update environment variables
- Set flowlibs_AzureDevOpsOrgName to your Azure DevOps org (e.g., "mycompany"); set flowlibs_AzureDevOpsProject to your project name; set flowlibs_AzDoBuildDefinitionId to your pipeline's definition ID (find this in the pipeline URL); set flowlibs_BuildFailureTeamLeadEmail to your team lead's email address.
- Update connection references
- Authenticate both the Azure DevOps and Office 365 Outlook connections.
- Turn on the flow
- The flow ships in Stopped state for safety — turn it on after configuration is verified.
- Change polling frequency
- Edit the Recurrence trigger to run more or less frequently than every hour.
- Add more recipients
- Modify the Send Email action to include CC/BCC addresses for broader visibility.
- Filter by date range
- Add a minTime parameter to ListBuilds to only check recent builds and reduce noise.
- Add Teams notification
- Insert a Post Message to Teams action alongside the email for real-time channel alerts.
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.01Build logs link
Direct URL to the build run in Azure DevOps.
EXPR.02Retry link
Link to the build definition for manual re-queue.
EXPR.03Failed build count check
Used in the condition to skip email if no failures found.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.