Data Factory Run Orchestration and Dependencies
The flow orchestrates a dependency-ordered sequence of Azure Data Factory pipelines - triggering each in order, polling to completion, gating downstream stages on upstream success, logging per-stage lineage to Dataverse - then reports the end-to-end run to Teams. Coordinates complex multi-pipeline data 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 flow orchestrates a dependency-ordered sequence of Azure Data Factory pipelines from a single, observable Power Automate Cloud flow. It reads a JSON dependency graph (the DAG), triggers each stage's ADF pipeline in order, polls each run to completion, gates downstream stages on upstream success, writes a per-stage lineage/audit row to Dataverse, and posts an end-to-end run report to Microsoft Teams.
Why it matters: cross-pipeline dependencies are hard to express inside a single ADF pipeline. A flow orchestrator gives flexible, observable end-to-end control with a governed audit trail and a single notification surface.
Ships Off (demo).
Use Case
A data team runs several ADF pipelines that must execute in a fixed dependency order (ingest raw to transform curated to publish marts). Each stage must finish successfully before the next begins; a failure should halt the remaining stages and surface immediately. This flow coordinates that sequence, records every stage outcome, and reports the whole run to Teams.
Flow Architecture
Nightly 01:00 Recurrence
RecurrenceStarts the orchestration nightly (swap for event/HTTP to start on demand).
Initialize Trace, Config & DAG
Initialize variableMints a correlation id; binds subscription/RG/factory, poll seconds, Teams ids; parses the pipeline DAG into an ordered stage list; seeds the overall-outcome (Succeeded) and run-summary accumulators.
For Each Stage (sequential)
Apply to each (concurrency 1)Walks the DAG in order; runs a stage only if the overall outcome is still Succeeded (the dependency gate).
Start + Poll Pipeline
ADF CreatePipelineRun + Do Until GetPipelineRunTriggers the stage's ADF pipeline and polls every poll-interval until a terminal state.
Log Stage + Evaluate
Dataverse CreateRecord + ConditionWrites a per-stage lineage/audit row; on success appends a success line, on failure flips the overall outcome to Failed so later stages log as Skipped.
Report to Teams
Teams - PostMessageToConversationPosts the overall outcome, per-stage summary, and correlation id to the channel.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_PipelineDag | String | [{"order":1,"name":"Ingest_Raw","pipeline":"pl_ingest_raw","dependsOn":[],"parameters":{}},{"order":2,"name":"Transform_Curated","pipeline":"pl_transform_curated","dependsOn":["Ingest_Raw"],"parameters":{}},{"order":3,"name":"Publish_Marts","pipeline":"pl_publish_marts","dependsOn":["Transform_Curated"],"parameters":{}}] | Ordered dependency graph: each stage has order, name, pipeline, dependsOn, parameters. |
| flowlibs_DataFactoryName | String | adf-yourcompany-analytics | Target Data Factory name. |
| flowlibs_PollSeconds | String | 30 | Seconds between run-status polls. |
| flowlibs_AdfSubscriptionId | String | <your-subscription-id> | Azure subscription GUID. |
| flowlibs_AdfResourceGroup | String | rg-data-prod | Resource group of the Data Factory. |
| flowlibs_TeamsGroupId | String | <your-team-id> | Teams team (group) id for the report. |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Teams channel id for the report. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Azure Data Factory | shared_azuredatafactory | CreatePipelineRun GetPipelineRun |
| 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.
- Conditional stages
- Add a runIf flag to each DAG entry and wrap Start_Stage_Pipeline in a Condition to skip stages based on upstream output.
- Fan-out / fan-in
- Split the DAG into independent branches and raise concurrency (or parallel Scopes), joining before the report. The build runs sequentially for deterministic ordering.
- Backfill
- Parameterize each stage's parameters (e.g. date windows) in the DAG and pass them to CreatePipelineRun.
- Retry transient failures
- Add a retry policy around Start_Stage_Pipeline when the run status is a transient failure.
- Event/on-demand start
- Replace the nightly recurrence with an HTTP, Dataverse, or Event Grid trigger.
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.01Parse the DAG
Ordered stage list.
EXPR.02Dependency gate
A stage runs only while the run is still healthy.
EXPR.03Run reached terminal state (Do Until)
Stops polling at a terminal status.
EXPR.04Duration in seconds
Logged per stage.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.