Rana Maninder Singh
Lesson 4 of 12Cloud Data & AI Engineering

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

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:

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 False

Teacher walkthrough: the 02:00 stock copy

All figures are illustrative.

  1. Linked service: the ERP export folder, reached through a self-hosted integration runtime because the folder is on Northline's file server.
  2. Linked service: the lake account in rg-nl-analytics.
  3. Copy activity writes raw/stock/2026-09-30/stock.csv and records rows_source from the export log.
  4. 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.
  5. Validation: for a day you know had 100 stock rows, rows_landed is 100 and FX-100 matches the warehouse screen for that as_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:

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:

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

  1. What is a pipeline?
  2. What is a linked service?
  3. When do you need a self-hosted integration runtime?
  4. A copy activity succeeds and lands 0 rows when the source promised 100. Is the business run acceptable?
  5. What should happen to the published path in that case?

Answers:

  1. A group of activities that run as one unit.
  2. The connection to a store or compute target.
  3. When the source is on a network the Azure runtime cannot reach, such as an office file share.
  4. No. Status succeeded is not enough. The counts do not match.
  5. 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.