The release flow
๐ฟFeature branch
Build in the dev factory (Git mode)
๐Pull request
Review the JSON changes
๐คCI
Validate, unit tests, export ARM template
๐CD
Deploy to test, then prod, with each environment's parameters
| Git term | Meaning in ADF |
|---|---|
| Collaboration branch (main) | Where finished work is merged |
| Feature branches | Your work in progress; Debug runs work here |
| Root folder | Folder in the repo holding factory/, pipeline/, dataset/... |
| adf_publish | Classic flow only: ARM templates written by the Publish button |
Step 1: validate with Microsoft's tool
The @microsoft/azure-data-factory-utilities npm package runs the same validation as ADF Studio, from the command line, with no Azure connection needed. This is the real output for our whole ShopKart factory:
$npm install @microsoft/azure-data-factory-utilities$node node_modules/@microsoft/azure-data-factory-utilities/lib/index validate ./shopkart-adf \$ /subscriptions/<sub-id>/resourceGroups/rg-shopkart-dev/providers/Microsoft.DataFactory/factories/adf-shopkart-dev
Validator: Start validation for: pipeline - PL_Copy_File_List
Validator: Start validation for: pipeline - PL_Copy_Supplier_File
Validator: Start validation for: pipeline - PL_Expressions_Demo
Validator: Start validation for: pipeline - PL_Incremental_Orders
Validator: Start validation for: pipeline - PL_Load_Supplier_Folder
Validator: Start validation for: pipeline - PL_Master_Daily
Validator: Start validation for: pipeline - PL_Process_Window
Validator: Start validation for: pipeline - PL_Wait_For_Flag
Validator: Start validation for: dataset - DS_ADLS_Parquet
Validator: Start validation for: dataset - DS_ADLS_ParquetFolder
Validator: Start validation for: dataset - DS_AzureSql_Query
Validator: Start validation for: dataset - DS_Blob_SupplierCsv
Validator: Start validation for: dataset - DS_Blob_SupplierFolder
Validator: Start validation for: linkedService - LS_ADLS_ShopKart
Validator: Start validation for: linkedService - LS_AzureSql_ShopKart
Validator: Start validation for: linkedService - LS_Blob_Supplier
Validator: Start validation for: linkedService - LS_KeyVault
Validator: Start validation for: trigger - TR_Daily_6AM_IST
Validator: Start validation for: trigger - TR_Hourly_Window
Validator: Start validation for: trigger - TR_Supplier_File_Arrived
Validator: Start validation for: dataflow - DF_Clean_Orders
Validation finished. No errors found.In lesson 6 the same tool caught our ForEach-inside-If mistake. In CI, a failed validation stops the release before anything reaches Azure.
Step 2: unit tests
The pipelines you've run throughout this course become automatic tests with pytest. Each test plays the part of the external systems and checks a rule that matters to the business:
"""Unit tests for ShopKart's Data Factory pipelines. Run with: pytest -v"""
import pytest
from data_factory_testing_framework import TestFramework, TestFrameworkType
from data_factory_testing_framework.state import DependencyCondition, RunParameter, RunParameterType
@pytest.fixture
def tf():
return TestFramework(framework_type=TestFrameworkType.DataFactory, root_folder_path="shopkart-adf",
should_evaluate_child_pipelines=True)
def test_incremental_copy_uses_both_watermarks(tf):
pipeline = tf.get_pipeline_by_name("PL_Incremental_Orders")
run = tf.evaluate_pipeline(pipeline, [RunParameter(RunParameterType.System, "RunId", "test-run")])
old = next(run)
old.set_result(DependencyCondition.Succeeded, {"firstRow": {"watermark_value": "2026-11-21T00:00:00Z"}})
new = next(run)
new.set_result(DependencyCondition.Succeeded, {"firstRow": {"new_watermark": "2026-11-22T06:30:00Z"}})
copy = next(run)
query = copy.type_properties["source"]["sqlReaderQuery"].result
assert "updated_at > '2026-11-21T00:00:00Z'" in query
assert "updated_at <= '2026-11-22T06:30:00Z'" in query
def test_watermark_not_updated_when_copy_fails(tf):
pipeline = tf.get_pipeline_by_name("PL_Incremental_Orders")
run = tf.evaluate_pipeline(pipeline, [RunParameter(RunParameterType.System, "RunId", "test-run")])
next(run).set_result(DependencyCondition.Succeeded, {"firstRow": {"watermark_value": "2026-11-21T00:00:00Z"}})
next(run).set_result(DependencyCondition.Succeeded, {"firstRow": {"new_watermark": "2026-11-22T06:30:00Z"}})
next(run).set_result(DependencyCondition.Failed, {}) # the Copy fails
names = [a.name for a in _drain(run)]
assert "Update Watermark" not in names # so the next run retries the same window
def test_only_csv_files_are_copied(tf):
pipeline = tf.get_pipeline_by_name("PL_Load_Supplier_Folder")
copied = []
for activity in _drain(tf.evaluate_pipeline(pipeline, [RunParameter(RunParameterType.System, "TriggerTime", "2026-11-22T06:00:00Z")])):
if activity.name == "List Files":
activity.set_result(DependencyCondition.Succeeded, {"childItems": [
{"name": "orders_2026-11-21.csv", "type": "File"},
{"name": "readme.txt", "type": "File"},
{"name": "archive", "type": "Folder"}]})
if activity.type == "Copy":
copied.append(activity.all_properties["inputs"][0]["parameters"]["fileName"].result)
assert copied == ["orders_2026-11-21.csv"]
def test_empty_folder_fails_the_run(tf):
pipeline = tf.get_pipeline_by_name("PL_Load_Supplier_Folder")
activities = []
for activity in _drain(tf.evaluate_pipeline(pipeline, [RunParameter(RunParameterType.System, "TriggerTime", "2026-11-22T06:00:00Z")])):
if activity.name == "List Files":
activity.set_result(DependencyCondition.Succeeded, {"childItems": []})
activities.append(activity)
assert activities[-1].type == "Fail"
assert activities[-1].type_properties["errorCode"] == "NO_FILES"
def _drain(run):
"""Collect activities until nothing else can run (the rest are skipped)."""
try:
for activity in run:
yield activity
except Exception as e:
if type(e).__name__ != "NoRemainingPipelineActivitiesMeetDependencyConditionsError":
raisetests/test_pipelines.py::test_incremental_copy_uses_both_watermarks PASSED [ 25%]
tests/test_pipelines.py::test_watermark_not_updated_when_copy_fails PASSED [ 50%]
tests/test_pipelines.py::test_only_csv_files_are_copied PASSED [ 75%]
tests/test_pipelines.py::test_empty_folder_fails_the_run PASSED [100%]
============================== 4 passed in 1.45s ===============================Step 3: export the ARM template
$node node_modules/@microsoft/azure-data-factory-utilities/lib/index export ./shopkart-adf \$ /subscriptions/<sub-id>/resourceGroups/rg-shopkart-dev/providers/Microsoft.DataFactory/factories/adf-shopkart-dev ArmTemplate
Validation finished. No errors found.
CmdApiApp: ARM template generated. Writing files...
CmdApiApp: ARM template export finished successfully.
$ ls ArmTemplate
ARMTemplateForFactory.json
ARMTemplateParametersForFactory.json
GlobalParametersUpdateScript.ps1
PrePostDeploymentScript.ps1
adf-shopkart-dev_GlobalParameters.json
linkedTemplates
parameters: factoryName, LS_AzureSql_ShopKart_connectionString,
LS_ADLS_ShopKart_properties_typeProperties_url,
LS_Blob_Supplier_properties_typeProperties_connectionString_secretName,
LS_KeyVault_properties_typeProperties_baseUrl,
TR_Hourly_Window_properties_pipeline_parameters_windowStart, ... (9 in total)
resources: 21One template with all 21 resources, and a parameters file listing what usually changes between environments (connection strings, URLs, secret names, trigger settings). Make a copy of the parameters file per environment.
Step 4: deploy
# .github/workflows/adf.yml (sketch: not run, needs an Azure subscription and secrets)
name: adf-ci-cd
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm install @microsoft/azure-data-factory-utilities
- name: Validate
run: node node_modules/@microsoft/azure-data-factory-utilities/lib/index validate ./shopkart-adf "$FACTORY_ID"
- name: Unit tests
run: pip install data-factory-testing-framework pytest && pytest -v
- name: Export ARM template
run: node node_modules/@microsoft/azure-data-factory-utilities/lib/index export ./shopkart-adf "$FACTORY_ID" ArmTemplate
- uses: actions/upload-artifact@v4
with: { name: arm, path: ArmTemplate }
# deploy job per environment: run PrePostDeploymentScript.ps1 (stop triggers),
# deploy ARMTemplateForFactory.json with that environment's parameters file, restart triggers.| Deployment rule | Why |
|---|---|
| Stop triggers, deploy, restart (PrePostDeploymentScript.ps1) | Avoid runs on half-deployed pipelines |
| Same template everywhere, different parameters | What you tested is what you ship |
| Secrets stay in each environment's Key Vault | Templates and Git never hold secrets |
| Global parameters per environment | env = test / prod, alert URLs |
| Deploy with a service principal or workload identity | No personal accounts in pipelines |
Download the whole project
The complete ShopKart factory from this course (all 21 JSON files), the run scripts from every lesson and the pytest tests: shopkart-adf-project.zip (23 KB). Change names like sql-shopkart-dev to your own resources before importing it into a factory's Git repository.
Fabric Data Factory in one minute
| Azure Data Factory | Fabric Data Factory | |
|---|---|---|
| Type | Azure PaaS resource | Part of Microsoft Fabric (SaaS) |
| Pipelines | Yes | Yes: same activities and expressions |
| Transformations | Mapping data flows | Dataflow Gen2 (Power Query), notebooks |
| Connections | Linked services + datasets | Connections (no separate datasets) |
| CI/CD | Git + ARM templates | Fabric Git integration + deployment pipelines |
๐ฏ Interview questions on this topic
Try to answer out loud first, then tap to check.
Q1How does Git integration work in ADF?Fresher+
Q2Explain ADF CI/CD.1โ3 yrs+
Q3How do you handle environment-specific values?1โ3 yrs+
Q4How would you test ADF pipelines?3+ yrs+
Key takeaways
- โGit + validation + tests + ARM templates = safe releases.
- โWe validated all 21 resources and ran 4 passing tests, no Azure needed.
- โSame template, different parameters for each environment.
- โFabric Data Factory uses the same skills.
Frequently asked questions
Why connect ADF to Git?
Every change is saved as JSON in a repository (Azure DevOps or GitHub): history, code review with pull requests, branches for features, and rollback. Without Git, changes go straight to the live factory.
What is the adf_publish branch?
In the classic flow, clicking Publish in Studio generates ARM templates from the collaboration branch and saves them to adf_publish. The modern recommended flow builds those templates in a CI pipeline with Microsoft's npm package instead, so you don't need to click Publish.
How do dev, test and prod differ?
Usually three factories. You develop in dev (with Git), and deploy the same ARM template to test and prod with a different parameters file per environment: server names, Key Vault URLs, global parameter values. Only the dev factory is connected to Git.
Can you unit test ADF pipelines?
Yes, with Microsoft's open-source data-factory-testing-framework: it evaluates pipeline JSON locally (expressions, conditions, loops) with outputs you supply. It doesn't move data, so keep a few integration tests in a test factory too.
What about Microsoft Fabric Data Factory?
Fabric includes Data Factory pipelines (same activities and expression language) and Dataflow Gen2 (Power Query based). It uses Fabric's own Git integration and deployment pipelines. The testing framework also supports Fabric pipelines. Your ADF skills transfer almost directly.
๐ง Quick check: CI/CD
1. Which file holds per-environment values during deployment?
2. What does PrePostDeploymentScript.ps1 do?
3. Which factory is connected to Git?
4. Our test 'watermark not updated when copy fails' protects against...
Checking your accessโฆ