Azure Data Factory
Lesson opener
In one line: A pipeline is a set of activities that run together. A green mark is not proof the row count matches the source.
Why it matters: Northline's stock file sometimes arrives at 02:00 and sometimes not at all. The factory still writes a success when the source folder is empty. The lake has a file with a header and no FX-100 rows. Figures are illustrative.
Before this lesson: You can name a raw path and the system of record for the file.
What you will be able to do
- Name a pipeline, an activity, a linked service, a dataset, and a trigger.
- Choose a schedule, a window, or an event without inventing a trigger type.
- Pick an integration runtime when the source is on Northline's network.
- Call a run successful only when status and counts agree.
Prerequisites
Lessons 1 to 3. You will not publish a factory in the practice. You will write the run rule.
What the factory is made of
Azure Data Factory is a managed orchestration service (https://learn.microsoft.com/en-us/azure/data-factory/introduction). The pieces this course uses:
- A pipeline groups activities that you want to run as one unit.
- An activity is one step, such as a copy.
- A linked service is the connection information for a store or a compute target.
- A dataset names the data the activity uses.
- A trigger starts a pipeline. Common kinds include a schedule, a tumbling window, and an event. A person can also start a run.
An integration runtime is the compute that does the work (https://learn.microsoft.com/en-us/azure/data-factory/concepts-integration-runtime). The Azure integration runtime runs in Azure. A self-hosted integration runtime runs on a machine you operate when the source is inside Northline's network and Azure cannot see it directly. The Azure-SSIS integration runtime is for SQL Server Integration Services packages. Do not stand up a self-hosted runtime "just in case" if the source is already a cloud store the Azure runtime can reach.
A pipeline run has a status such as Succeeded or Failed. Status is about the activities finishing. It is not the business check. Northline adds a second gate: rows written must equal rows the source said it sent, and zero is a failure when the source promised a file.
def run_ok(status, rows_source, rows_landed, empty_allowed):
if status != "Succeeded":
return False
if rows_source == 0 and not empty_allowed:
return False
return rows_source == rows_landed
assert run_ok("Succeeded", 100, 100, False) is True
assert run_ok("Succeeded", 0, 0, False) is False
assert run_ok("Failed", 100, 100, False) is False
assert run_ok("Succeeded", 100, 90, False) is FalseTeacher walkthrough: the 02:00 stock copy
All figures are illustrative.
- Linked service: the ERP export folder, reached through a self-hosted integration runtime because the folder is on Northline's file server.
- Linked service: the lake account in
rg-nl-analytics. - Copy activity writes
raw/stock/2026-09-30/stock.csvand recordsrows_sourcefrom the export log. - The schedule trigger fires at 02:15. If the log is missing, the run fails the count gate even when the copy activity copied an empty file.
- Validation: for a day you know had 100 stock rows,
rows_landedis 100 and FX-100 matches the warehouse screen for thatas_of.
A second workplace case
Wholesale already lands files in a cloud store the Azure runtime can read. A self-hosted runtime would add a machine to patch for no reachability reason. The Azure integration runtime is the match. The self-hosted runtime stays on the retail file server that Azure cannot see.
Failure example: success on an empty file
Symptom: Monday's pipeline run is Succeeded. published/stock still shows Sunday. The raw file has a header and no data rows. Purchasing buys against Sunday's count.
Diagnosis: The copy activity succeeded at copying bytes. Nobody compared rows_source to rows_landed. An empty extract was treated as a normal file. The root cause is a missing business gate, not a red Azure status.
Correction: Fail the run when the source promised rows and the file has none. Do not publish curated data from that run. Leave Sunday's published path in place.
Validation: Replay an empty test file. The run is not accepted. The published path's as_of is unchanged. Replay a 100-row file. The counts match and the published path may advance.
Guided practice: name the pieces
Scenario: Supplier invoices appear as files on a share inside Northline's office. Finance wants them in raw/invoice/ by 06:00. An empty morning is a failure. Figures are illustrative.
Hints:
- Which runtime can see the office share?
- What is the trigger?
- What two numbers must match?
Complete solution:
Use a self-hosted integration runtime on a machine that can read the share. The linked services point at that share and at the lake. One copy activity writes raw/invoice/yyyy/mm/dd/. A schedule trigger at 05:30 gives the 06:00 check a window. run_ok requires status Succeeded, a non-zero source count, and equal landed rows. An empty file fails. Finance does not read raw. They read a published path that updates only after the gate passes.
Independent practice
Describe one pipeline you would trust.
Acceptance criteria:
- You name the pipeline, one activity, two linked services, and the trigger type.
- You name the integration runtime and why that one can see the source.
- You write the count rule, including whether zero rows is a failure.
- You say which published path stays unchanged when the rule fails.
- You do not treat activity status alone as the business result.
Common mistakes
- A self-hosted integration runtime for a source that is already in Azure.
- A schedule that fires before the source file exists, then marks success on a miss.
- Publishing raw bytes straight to the path Power BI reads.
- Storing the file-server password in the pipeline name or in a chat log. The linked service should use a secret the platform can store, not a pasted password in the activity label.
Quick check
- What is a pipeline?
- What is a linked service?
- When do you need a self-hosted integration runtime?
- A copy activity succeeds and lands 0 rows when the source promised 100. Is the business run acceptable?
- What should happen to the published path in that case?
Answers:
- A group of activities that run as one unit.
- The connection to a store or compute target.
- When the source is on a network the Azure runtime cannot reach, such as an office file share.
- No. Status succeeded is not enough. The counts do not match.
- Leave the previous published data in place.
Quiz alignment
The quiz asks you to name factory parts, choose an integration runtime, and reject a succeeded run whose row counts do not match.
Lesson summary
Data Factory starts activities with triggers and moves data with an integration runtime that can actually see the source. Succeeded means the activities finished. Northline also requires the row counts to match before anyone publishes the file.
Bridge to the next lesson
The next lesson queries the lake with Synapse: a serverless pool over files, and a dedicated pool that stores tables. You will decide which one Power BI is allowed to hit.