Most ADF pipelines start as a sequence of activities that works once, then grow into a tangle of hard-coded paths, implicit dependencies, and a schedule nobody can explain. The difference between a pipeline that survives years of change and one that everyone is afraid to touch comes down to a few structural decisions made early.
In this lesson you will learn how to:
- Model activity dependencies and execution order deliberately.
- Choose the right trigger type, including when backfill matters.
- Parameterize without duplicating pipelines per environment.
- Handle retries, timeouts, and failures as design elements.
Prerequisites
- !ADF authoring and dataset creation
- !Linked services and Key Vault references
- !A working factory with Git integration
Anatomy of a pipeline run
A run begins when a trigger fires or a manual call starts the pipeline, and it produces a run id that every activity execution inherits. Understanding this hierarchy matters when you debug, because monitoring in the portal is grouped by pipeline run while failures are reported at activity level, and the two views answer different questions.
Each activity can run in sequence or in parallel, and dependencies can be conditioned on success, failure, or completion. That last option is where most error-handling value lives: a notification activity wired on completion always runs, whether the load succeeded or not, so cleanup and alerting never depend on remembering to add an else branch.
Execution also interacts with integration runtimes. A self-hosted runtime gives you network reach into a private network, while the hosted runtime handles public endpoints, and mixing them in one pipeline means one activity may have connectivity while the adjacent one does not. Keep the boundary explicit rather than accidental.
Modelling dependencies explicitly
The pipeline definition is JSON, and reading it carefully is the fastest way to understand what a colleague shipped.
{
"name": "pl_daily_sales_load",
"properties": {
"activities": [
{
"name": "check_source_partition",
"type": "Lookup",
"dependsOn": [],
"policy": { "timeout": "0.00:10:00", "retry": 2 },
"typeProperties": {
"source": {
"type": "JsonSource",
"storeSettings": { "type": "AzureBlobFSReadSettings" }
},
"dataset": { "referenceName": "ds_source_manifest" },
"firstRowOnly": true
}
},
{
"name": "copy_sales",
"type": "CopyActivity",
"dependsOn": [
{ "activity": "check_source_partition", "dependencyConditions": ["Succeeded"] }
],
"typeProperties": {
"source": { "dataset": { "referenceName": "ds_source_sales" } },
"sink": { "dataset": { "referenceName": "ds_bronze_sales" } }
}
},
{
"name": "notify_result",
"type": "WebActivity",
"dependsOn": [
{ "activity": "copy_sales", "dependencyConditions": ["Completed"] }
],
"typeProperties": {
"url": "{{webhookUrl}}",
"method": "POST",
"body": "runId=@pipeline().RunId status=@activity('copy_sales').status"
}
}
]
}
}
Two details carry weight. The Lookup gate prevents a pointless copy when the manifest says the partition has not landed, which converts a silent empty load into an explicit no-op. The final notification depends on Completed rather than Succeeded, so the team hears about failures from the pipeline itself instead of learning about them from a stale dashboard.
Trigger types and when each one fits
| Trigger | Fires | Backfill | Typical use |
|---|---|---|---|
| Schedule | Fixed interval | No | Periodic refresh of reference data |
| Tumbling window | Non-overlapping windows | Yes | Time-sliced ingestion with guaranteed order |
| Event | Storage or Event Grid event | Not applicable | Landing-zone driven loads |
| API | External system call | No | On-demand downstream integration |
Tumbling window triggers are the workhorse for time-based ingestion because they track window state, support a concurrency limit, and can re-run missed windows after downtime. Set maxConcurrency deliberately: too high and two windows compete for the same source, too low and a backlog builds and never clears. Events suit variable arrival patterns where polling would waste effort, but they require careful idempotency because the same file may be announced more than once.
Parameters, variables, and linked service design
Parameterization exists so that one pipeline works across dates, environments, and tenants. Use pipeline parameters for values that vary per invocation, such as a business date or a source path prefix, and global parameters for values that vary per environment but are fixed within one.
{
"name": "pl_incremental_load",
"properties": {
"parameters": {
"bizDate": { "type": "string", "defaultValue": "" },
"sourceFolder": { "type": "string", "defaultValue": "raw" }
},
"variables": {
"rowsRejected": { "type": "int" }
},
"activities": [
{
"name": "copy",
"type": "CopyActivity",
"typeProperties": {
"source": {
"dataset": { "referenceName": "ds_source" }
}
}
}
]
}
}
Keep secrets out of parameters entirely. A linked service should reference Key Vault for its connection string, with the Key Vault URI held in an environment-scoped variable group. When a pipeline parameter looks like it wants a password, that is a design smell: the value belongs in a secret store, and the pipeline should express which resource to talk to, never how to authenticate to it.
Failures, retries, and timeouts as design
Every activity should declare a timeout. Without one, a hung source connection can block a pipeline indefinitely and hold an integration runtime slot while nobody is paged. Set retries with exponential backoff for transient faults, and cap total attempts so a genuinely broken dependency fails loudly instead of retrying into the next scheduled window.
Separate retryable from non-retryable failures in your handling. Network timeouts deserve a retry; a schema mismatch does not, and retrying it just delays the error by twenty minutes. Route non-retryable failures straight to a notification and a quarantine path so a human sees the real cause quickly.
Debugging before you publish
Data flow debug mode and pipeline debug runs exist so that problems surface in development rather than at two in the morning. Use preview to inspect row counts at each transformation, watch for implicit type coercions, and confirm that a filter behaves the way its expression suggests rather than the way its author intended.
Read the monitoring view after each test run. Activity durations reveal a copy that is far slower than expected, queue time reveals contention for the integration runtime, and repeated retries on a single activity usually point at permissions rather than at data. Fix the cause in the repository, then publish, because a hotfix applied directly in the factory will be reverted by the next deployment.
Reuse without duplicating pipelines
Teams that copy a pipeline to create a sibling end up with twelve near-identical objects that drift apart after the first change. Prefer parameters and templates: define one pipeline that accepts source and sink datasets as parameters, then invoke it from other pipelines through execute-pipeline activities with different arguments.
Expressions carry the same principle. Use activity and pipeline expressions for values known only at runtime, such as the row count returned by a lookup or the current window start, rather than baking them into dataset definitions. When an expression becomes long, move the logic into a user-defined expression or a pre-activity script, because a single unreadable line inside a JSON blob is where review quality collapses.
Keep shared definitions in a separate folder in the repository so that a template change is visible as one diff. Then a factory-level template, or a second factory used for integration tests, gives you a place to run the parameterized version against fixtures before it ever touches production data.
Common Mistakes
Hard-coding container paths inside each activity
Fix: Expose them as parameters with sensible defaults so one pipeline serves many dates and environments.
Setting no timeout on activities that talk to external systems
Fix: Declare a timeout on every activity so a hung dependency fails and alerts instead of blocking silently.
Wiring error handling on success dependencies only
Fix: Use Completed dependencies for notifications and cleanup so failures are reported by the pipeline itself.
Retrying non-transient failures such as schema errors
Fix: Distinguish retryable faults from data errors and route data errors straight to quarantine and alerting.
Best Practices
- Give every activity a timeout, a retry policy, and an owner
- Keep secrets in Key Vault and express only resource identity in parameters
- Prefer tumbling window triggers where missed windows must be replayed
- Test with debug runs and data preview before publishing
- Document the expected failure modes in the pipeline's own description
Questions interviewers ask about ADF
đ¯Interview Tip
Trigger questions come up frequently. Be ready to contrast tumbling window and schedule triggers on exactly-once semantics and backfill, then give an example where a schedule trigger would silently skip a window after an outage.
Interview Questions
Q1: Tumbling window or schedule trigger for hourly ingestion?
Tumbling window, because it tracks window state, guarantees non-overlapping execution, supports concurrency limits, and backfills missed windows after downtime. A schedule trigger simply fires at intervals and can skip or double-process windows without any state.
Q2: How do you parameterize a pipeline across environments?
Pipeline parameters cover per-run values such as dates and paths, global parameters cover environment-level switches, and linked services pull connection details from Key Vault referenced through environment-scoped variable groups. Secrets never appear in parameters.
Q3: When do you use a mapping data flow instead of copy activity?
Use copy when data simply moves or changes format, since it is optimized for throughput. Use a data flow when rows must be joined, aggregated, or derived with visual debugging, accepting the Spark compute cost that comes with it.
Q4: How would you handle a failed activity at two in the morning?
Depend on Completed for an alerting activity, send the failed activity name and error to the on-call channel, quarantine the partial output rather than leaving it in the silver path, and require a human decision before a non-retryable failure is replayed.
Key Takeaways
- Run ids link pipeline-level monitoring to activity-level failures
- Completed dependencies make error handling automatic
- Tumbling window triggers bring state, concurrency control, and backfill
- Parameters express identity and shape; secrets stay in Key Vault
- Timeouts and bounded retries turn hangs into visible failures
- Fix problems in the branch, then publish, so the change survives