The Azure data stack

Part of the free LogicWiz Data Engineering course, Module 14: Cloud data platforms. The SQL and Python run in the app, on real Postgres and real Python in the browser.

It is 9:00 on Thursday. A retail group that runs on Microsoft has bought SwiftKart, and the nightly copy of 50 tables must run on Azure by Monday. The first draft has 50 pipelines, with the Postgres password pasted into every one. Nora looks at it for a while. "One pipeline. No passwords. And draw me which Azure service does each job."

You'll learn to

  • Place each Azure data service in one pipeline
  • Explain what real folders change in a data lake
  • Drive many copies from one control table
  • Trace how Azure decides who may read a file

Learn

Five jobs, eight Azure names

Start with the drawing Nora asked for. Every pipeline does five jobs: bring data in, store it, transform it, serve it, and guard it. On Azure each job has a service. The group already uses two of them: Entra ID for logins and Power BI for finance.

Read the picture from left to right. Data Factory copies the store's Postgres tables and partner files into a lake on ADLS Gen2. Databricks jobs clean them into silver and gold. Databricks SQL serves gold to Power BI. Off to the side, Key Vault hands Data Factory the one secret it needs.

SwiftKart on Azure, end to end

A graph from the shop database and partner files through Data Factory with a self-hosted runtime into bronze on ADLS Gen2, then Databricks jobs merging into silver and gold Delta tables, served by Databricks SQL to Power BI, with Key Vault giving Data Factory its secret.

Read it left to right: data follows the solid arrows; the dashed arrow carries a secret, not data.

The Azure data stack

ServiceWhat it is
ADLS Gen2Storage accounts with a hierarchical namespace: the data lake
Data Factory (ADF)Managed pipelines that copy data and run activities on triggers
Azure DatabricksDatabricks (Module 13) offered as an Azure service
Synapse AnalyticsSQL pools (a warehouse, and serverless SQL over the lake) and Spark
Microsoft FabricOne SaaS platform: OneLake, lakehouses, warehouses, pipelines, Power BI
Key VaultA safe for secrets, keys and certificates
Entra IDIdentity: users, groups, service principals, managed identities
Power BIDashboards and reports

A lake with real folders

In Lesson 14.1 a folder was only a shared beginning of names, and renaming one meant copying every object. Azure Data Lake Storage Gen2 fixes that. It is Blob Storage with the hierarchical namespace switched on.

Now prefixes are real directories. Renaming or deleting one updates a single entry, the parent directory, so Spark's rename-based commit (Lesson 11.5) is fast and atomic here, unlike on flat Blob Storage or S3. Folders and files can carry ACLs: read, write and execute, per user or group.

A storage account holds containers (also called file systems). Spark addresses a file as abfss://<container>@<account>.dfs.core.windows.net/<path>; dfs is the endpoint that understands directories.

Past an account's request target Azure answers 503 Server Busy, so big backfills spread across accounts and write fewer, larger files.

Build and read an abfss path

def abfss(account, container, path):
    return f'abfss://{container}@{account}.dfs.core.windows.net/{path}'

def parse_abfss(uri):
    rest = uri.removeprefix('abfss://')
    container, rest = rest.split('@', 1)
    host, path = rest.split('/', 1)
    return {'account': host.split('.')[0], 'container': container, 'path': path}

uri = abfss('swiftkartlake', 'lake', 'bronze/orders/2025-06-01.csv')
print(uri)
print(parse_abfss(uri))

The container comes before the @ and the account after it. Mixing them up is the most common first error on Azure.

Create the lake and upload a file with the az CLI

Runs in the cloud:

az storage account create --name swiftkartlake --resource-group rg-swiftkart-data \
  --location westeurope --sku Standard_LRS --kind StorageV2 --hns true

az storage fs create --name lake --account-name swiftkartlake --auth-mode login

az storage fs file upload --file-system lake --account-name swiftkartlake --auth-mode login \
  --source orders.csv --path bronze/orders/2025-06-01.csv

az storage fs file list --file-system lake --account-name swiftkartlake --auth-mode login \
  --path bronze/orders --query "[].name" --output tsv
bronze/orders/2025-06-01.csv

--hns true switches on the hierarchical namespace. --auth-mode login uses your Entra ID sign-in instead of the account key, and needs a data role such as Storage Blob Data Contributor.

One pipeline for fifty tables

Now the copy. Azure Data Factory (ADF) moves data on a schedule, with no servers to run. Its parts:

  • A pipeline is a workflow of activities: Copy, Lookup, ForEach, run a Databricks notebook.
  • A linked service is a connection (to Postgres, to ADLS), its secret kept in Key Vault.
  • A dataset points at the data and describes its shape.
  • An integration runtime does the copying: the Azure one for cloud sources, a self-hosted one inside the company network for on-premises databases.
  • A trigger starts it: a schedule, a tumbling window (fixed time slices, easy to backfill), or a file arriving.

Fifty tables need one metadata-driven pipeline, not fifty: it reads the list of tables from a control table and loops over it.

One pipeline, one turn per table

Four activities in a row, Lookup, ForEach, Copy and a watermark update, light up one after another as the pipeline copies the orders table from a row of the control table.

  1. Lookup. The pipeline reads the control table etl_control. Four tables are enabled tonight (events is switched off), and each row carries the query to run.

  2. ForEach. The loop runs once for each row. @item() is the current row: follow orders, whose query asks for the rows changed since its watermark, 10 June.

  3. Copy. One Copy activity runs that query against Postgres and writes the rows to bronze as Parquet. The same activity serves every table.

  4. Move the watermark. The copy succeeded, so a last step moves last_watermark forward to the newest value copied (Module 6). A 51st table is one INSERT into the control table.

Read each step left to right: blue is the activity running now, green is finished.

Run the Lookup yourself

SELECT table_name,
       CASE WHEN watermark_column IS NULL
            THEN format('SELECT * FROM %I', table_name)
            ELSE format('SELECT * FROM %I WHERE %I > %L', table_name, watermark_column, last_watermark)
       END AS source_query
FROM etl_control
WHERE enabled
ORDER BY table_name;

This is what ADF's Lookup activity returns: one row per enabled table, with the query its Copy will run. products has no watermark column, so it is copied whole.

The pipeline in ADF's JSON (shortened)

Runs in the cloud:

{
  "name": "copy_swiftkart_tables",
  "properties": {
    "activities": [
      {
        "name": "LookupTables",
        "type": "Lookup",
        "typeProperties": {
          "source": { "type": "AzurePostgreSqlSource", "query": "SELECT table_name, source_query FROM etl_plan" },
          "firstRowOnly": false
        }
      },
      {
        "name": "ForEachTable",
        "type": "ForEach",
        "dependsOn": [ { "activity": "LookupTables", "dependencyConditions": [ "Succeeded" ] } ],
        "typeProperties": {
          "items": { "value": "@activity('LookupTables').output.value", "type": "Expression" },
          "activities": [
            {
              "name": "CopyToBronze",
              "type": "Copy",
              "typeProperties": {
                "source": { "type": "AzurePostgreSqlSource", "query": { "value": "@item().source_query", "type": "Expression" } },
                "sink": { "type": "ParquetSink" }
              }
            }
          ]
        }
      }
    ]
  }
}

You draw pipelines in ADF Studio, which saves this JSON to Git. ADF bills each copy in Data Integration Units (DIUs), a bundle of CPU, memory and network: DIUs x copy duration x the price per DIU-hour.

No password in the pipeline

Next, the 50 pasted passwords. A password must not sit in a notebook or a pipeline. It goes in Key Vault, a safe for secrets. ADF and a Databricks secret scope read it at run time, and a notebook that prints it shows [REDACTED].

Better still, need no secret at all. A managed identity is an identity Azure gives a service, such as your Data Factory. Grant it a role on the storage account, and no key exists to leak.

Roles are granted through Azure RBAC at a scope: a subscription, a resource group, a storage account, or one container. Think of a building pass: a pass for a floor opens every room on it. A role applies to everything inside its scope.

Who can touch the lake container?

rg = '/subscriptions/s1/resourceGroups/rg-data'
account = rg + '/providers/Microsoft.Storage/storageAccounts/swiftkartlake'
lake = account + '/blobServices/default/containers/lake'

assignments = [   # (principal, role, scope)
    ('adf-swiftkart', 'Storage Blob Data Contributor', lake),
    ('analysts', 'Storage Blob Data Reader', rg),
    ('maya', 'Owner', '/subscriptions/s1'),
]
DATA_ACTIONS = {
    'Storage Blob Data Reader': {'read'},
    'Storage Blob Data Contributor': {'read', 'write', 'delete'},
    'Owner': set(),                # manages resources; holds no data actions
}

def can(principal, action, scope):
    return any(who == principal and action in DATA_ACTIONS[role]
               and (scope == at or scope.startswith(at + '/'))
               for who, role, at in assignments)

for who, action in [('adf-swiftkart', 'write'), ('analysts', 'read'), ('analysts', 'write'), ('maya', 'read')]:
    print(who, action, can(who, action, lake))

Analysts read through a role on the resource group, inherited downwards. maya owns the whole subscription yet cannot read a blob: Owner manages resources, data roles read data.

Why the owner cannot read a file

The last line of that run looks wrong. It is not: Azure checks a data request in a fixed order, and owning a resource is not on the list.

The caller shows an Entra ID token. Deny assignments come first and block access whatever the roles say. Then Azure looks for a role assignment, at the resource's scope or above, whose role includes the needed data action. A role's data permissions are its DataActions minus its NotDataActions; its Actions only manage the resource. Any conditions on the assignment must be true.

ADLS Gen2 adds the folders' POSIX ACLs, checked only when no role granted access: execute (x) on every folder from the container root down, and read (r) on the file.

Two reads on ADLS Gen2, decided

Six gates from an Entra ID token down to read allowed: the factory passes through a role assignment and skips the ACLs, then an analyst team with no role falls through to the folder ACLs and is refused at the container root.

  1. The factory reads bronze/orders. Data Factory shows the token of its managed identity. No deny assignment matches, so the request goes on.

  2. A role grants it. The identity holds Storage Blob Data Contributor on the container, and that role includes reading. No conditions are attached. The read is allowed, and the ACLs are never looked at.

  3. An analyst team reads gold/. Their token is fine and nothing denies them, but they hold no data role at any scope. Azure falls through to the folder ACLs.

  4. The ACLs say no. The team has r-x on gold/ but no x on the container root. ACLs need execute on each parent folder, all the way down, so every read fails.

Read it top to bottom: a role that grants the read skips the ACLs, and only without one does the last gate decide.

The Owner who cannot read a file. Owner and Contributor are management roles: they create and configure the storage account, but do not let your login read its data. That needs a data role such as Storage Blob Data Reader. The opposite mistake is worse: sharing the storage account key, which opens everything in the account and bypasses every role. Prefer managed identities, and disable key access where you can.

Synapse: one table in 60 pieces

Two more names from the whiteboard, because the group already runs both.

Azure Synapse Analytics bundles a warehouse (dedicated SQL pools, sized and paid for while they run), serverless SQL that queries lake files and bills per data processed, and Spark pools. Many companies still run it.

Open the dedicated pool. It splits every table into 60 distributions, like dealing one deck of cards into 60 piles, and runs each query as 60 smaller queries. The service level you buy, measured in DWUs, decides how many compute nodes share the 60 piles.

A dedicated SQL pool with two compute nodes

Boxes show a control node and two compute nodes holding 30 of the 60 distributions each, the Data Movement Service between them, and Azure Storage holding the data underneath.

The control node sends one plan as 60 queries; here each compute node runs 30. Scale up and the same 60 distributions are remapped to more nodes, with no data reloaded: at the largest size each node holds one, at the smallest one node holds all 60.

Fabric: a bill spread over a day

Microsoft Fabric is the newer all-in-one SaaS platform. Tables live in OneLake as Delta, and lakehouses, warehouses, pipelines, notebooks and Power BI all use the same copy.

You do not pay per service. You buy a capacity of capacity units (CUs) shared by every workload: an F64 has 64 CUs. And Fabric does not charge a job to the hour it ran. It smooths the cost: interactive work over at least five minutes, background jobs over 24 hours. Owe more than the capacity can pay off and Fabric throttles: first interactive jobs wait, then they are rejected.

New Azure projects usually choose Databricks, Fabric, or both.

A nightly job on an F64, after smoothing

A bar of 64 capacity units: 32 are taken for a whole day by a nightly Spark job smoothed over 24 hours, and 32 are left for interactive reports.

The job used 2,764,800 CU-seconds in one night. Fabric spreads background work over the next 24 hours: 2,764,800 / 86,400 = 32 CUs, half the capacity, for a whole day. Add a second job of the same size and nothing is left for the finance dashboards.

Remember: size a Fabric capacity for its smoothed load, not for the hour the job ran.

Numbers to remember

WhatThe number or the rule
ADLS Gen2 request target40,000 requests a second per account in large regions, 20,000 elsewhere; up to 3,000 per block blob
ADF copy4 to 256 DIUs per copy
Synapse dedicated pool60 distributions per table (hash, round-robin or replicated) on 1 to 60 compute nodes; the Data Movement Service moves rows between nodes when a join is not aligned (Lesson 14.5)
Fabric throttlingpast 10 minutes of future capacity used, interactive jobs wait 20 seconds; past 60 minutes they are rejected; past 24 hours, everything is
ACL entriesat most 32 per file or folder, 28 of them yours
Role assignmentsat most 5,000 per subscription, so grant to groups, never to people one by one

What changed at SwiftKart

By Monday the 50 pipelines are one, driven by one control table. The password sits in Key Vault, and the factory reaches the lake through its managed identity, with a data role on one container.

The drawing also answers "walk me through an Azure data platform". Go stage by stage: ADF ingests (metadata-driven, with watermarks), ADLS Gen2 stores bronze, silver and gold as Delta under Unity Catalog, Databricks transforms (MERGE into silver, replaceWhere into gold), SQL and Power BI serve. Then add what marks a strong candidate: managed identities, RBAC at the right scope, Key Vault, alerts from Azure Monitor, a catalogue in Purview.

Next, Lesson 14.3 draws the same pipeline on AWS and Google Cloud.

In one line

On Azure, Data Factory copies data in from one control table, ADLS Gen2 stores it in real folders, Databricks or Fabric transforms it, and managed identities with data roles replace passwords.

Interview corner

Describe a typical Azure data platform.

Data Factory copies data from sources into ADLS Gen2, usually with a metadata-driven pipeline and watermarks, using a self-hosted integration runtime for on-premises systems. Databricks (or Fabric) transforms bronze into silver and gold Delta tables. Serving is Databricks SQL, a Fabric or Synapse warehouse, and Power BI. Identity is Entra ID with managed identities and RBAC, secrets live in Key Vault, and Azure Monitor sends alerts.

How do you load 50 tables with Data Factory without 50 pipelines?

A metadata-driven pipeline: a control table lists each table, its watermark column and last watermark, and whether it is enabled. A Lookup reads it, a ForEach runs a parameterised Copy per row with a query built from the watermark, and a final step updates the watermark after each successful copy. Adding a table is a row in the control table.

What is the difference between Owner and Storage Blob Data Reader?

Owner is a control-plane role: it manages the resource, its settings and its access. Storage Blob Data Reader is a data-plane role: it lets an Entra ID identity read blobs. An Owner reading data with their login gets an authorisation error until they also hold a data role. Pipelines should use managed identities with data roles at the narrowest scope.

How does ADLS Gen2 decide whether a service principal may read a file?

Azure RBAC first: a matching deny assignment blocks the request; otherwise a role assignment at the container, account, resource group or subscription whose role includes the blob read data action grants it, and conditions on that assignment must hold. Only if RBAC does not grant access are the POSIX ACLs checked, and then the principal needs execute on every folder from the root down plus read on the file. Each object holds at most 32 ACL entries and a subscription 5,000 role assignments, so grant roles and ACLs to groups. A missing execute on a parent folder is the usual reason a correct-looking ACL fails.