Data platforms deserve the same release discipline as applications
Prerequisites
- !Git branching models and pull request workflows
- !Azure Data Factory Git integration basics
- !Bicep or ARM template fundamentals
What You'll Learn
- 1Structure multi-stage YAML pipelines for data platform releases
- 2Promote infrastructure with Bicep across dev, test, and prod
- 3Inject secrets through Key Vault-linked variable groups
- 4Design approvals, gates, and rollbacks that match data risk
Why data CI/CD is harder than application CI/CD
Application deployments move code behind a versioned artifact. Data platform deployments move something messier: an ADF factory whose JSON definitions reference linked services, integration runtimes, and datasets that exist differently in each environment; a Databricks workspace whose notebooks import libraries with pinned versions; a Synapse workspace whose SQL pools cannot simply be torn down between releases. The pipeline must translate environment-agnostic definitions into environment-specific wiring without hardcoding subscription IDs into the source tree.
The three patterns that make this manageable are parameterization, separation of infrastructure from orchestration, and promotion by artifact rather than by click. Parameterization means every environment-specific value lives in a parameter file or variable group keyed by environment name. Separation means Bicep owns the infrastructure while ADF or Databricks owns the logic, and the release pipeline deploys them in that order. Promotion by artifact means the exact same tested output is deployed to test and then to prod, so what you validated is what runs, not a re-export of a workspace that drifted since the last merge.
A multi-stage YAML pipeline that earns its length
A good data platform pipeline has a build stage that validates and tests, then per-environment deployment stages that run in order with approval gates between them. The build stage runs unit tests for any Python or SQL logic, validates Bicep syntax, and publishes the artifacts. The deployment stages are thin: download the artifact, deploy infrastructure, then deploy the data plane resources that depend on it. Keeping the deployment stages thin is what makes them safe to re-run during an incident.
# azure-pipelines.yml
trigger:
branches:
include:
- main
- feature/*
variables:
- group: de-platform-variables # linked to Key Vault
- name: bicepTemplate
value: infra/main.bicep
stages:
- stage: Build
displayName: Validate and test
jobs:
- job: ValidateAndTest
pool:
vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: "3.11"
- script: |
pip install pytest great-expectations
pytest tests/ --junitxml=test-results.xml
displayName: Run unit and data quality tests
- task: PublishTestResults@2
inputs:
testResultsFiles: test-results.xml
- task: AzureCLI@2
inputs:
azureSubscription: $(azureServiceConnectionDev)
scriptType: bash
inlineScript: |
az deployment group validate \
--resource-group rg-de-dev \
--template-file $(bicepTemplate) \
--parameters environment=dev
displayName: Validate Bicep template
- stage: DeployDev
displayName: Deploy to dev
dependsOn: Build
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
jobs:
- deployment: DeployDev
environment: dev
strategy:
runOnce:
deploy:
steps:
- task: AzureCLI@2
inputs:
azureSubscription: $(azureServiceConnectionDev)
scriptType: bash
inlineScript: |
az deployment group create \
--resource-group rg-de-dev \
--template-file $(bicepTemplate) \
--parameters environment=dev \
--name $(Build.BuildId)-dev
- task: AzureCLI@2
inputs:
azureSubscription: $(azureServiceConnectionDev)
scriptType: bash
inlineScript: |
python scripts/publish_adf.py \
--factory-name adf-de-dev \
--arm-template artifacts/adf-arm.json
displayName: Publish ADF pipelines
- stage: DeployProd
displayName: Deploy to production
dependsOn: DeployDev
condition: succeeded()
jobs:
- deployment: DeployProd
environment: prod # approvals configured on the environment
strategy:
runOnce:
deploy:
steps:
- task: AzureCLI@2
inputs:
azureSubscription: $(azureServiceConnectionProd)
scriptType: bash
inlineScript: |
az deployment group create \
--resource-group rg-de-prod \
--template-file $(bicepTemplate) \
--parameters environment=prod \
--name $(Build.BuildId)-prod
- task: AzureCLI@2
inputs:
azureSubscription: $(azureServiceConnectionProd)
scriptType: bash
inlineScript: |
python scripts/publish_adf.py \
--factory-name adf-de-prod \
--arm-template artifacts/adf-arm.json
Bicep: environment parameters without duplication
Bicep keeps infrastructure declarative and reviewable in the same pull request as the pipeline logic it supports. The environment parameter drives naming, SKU selection, and retention settings through a single module rather than three copy-pasted templates. That matters because infrastructure drift between environments is the most common cause of "it worked in dev" releases; when environments are generated from one parameterized template, drift becomes a diff you can see in the pull request.
Pair the template with a parameter file per environment, or pass parameters inline from the pipeline as above, and you never again hand-edit a resource in the portal without a corresponding commit. The discipline is enforced by the tool rather than by good intentions, which is the only kind of discipline that survives a busy quarter.
// infra/main.bicep
param environment string = 'dev'
param location string = resourceGroup().location
var suffix = environment
var skuName = environment == 'prod' ? 'Standard' : 'Basic'
resource storage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'stde${suffix}'
location: location
sku: { name: 'Standard_LRS' }
kind: 'StorageV2'
properties: {
supportsHttpsTrafficOnly: true
minimumTlsVersion: 'TLS1_2'
allowBlobPublicAccess: false
}
}
resource factory 'Microsoft.DataFactory/factories@2018-06-01' = {
name: 'adf-de-${suffix}'
location: location
identity: { type: 'SystemAssigned' }
properties: {
publicNetworkAccess: environment == 'prod' ? 'Disabled' : 'Enabled'
}
}
resource law 'Microsoft.OperationalInsights/workspaces@2022-10-01' = {
name: 'law-de-${suffix}'
location: location
properties: {
sku: { name: environment == 'prod' ? 'PerGB2018' : 'Free' }
retentionInDays: environment == 'prod' ? 90 : 30
}
}
output factoryPrincipalId string = factory.identity.principalId
output storageAccountName string = storage.name
Secrets in pipelines: variable groups and Key Vault
The rule that satisfies both security review and the on-call engineer is that no secret ever appears in YAML or in the repository history. Azure DevOps variable groups can be linked directly to a Key Vault, so the pipeline run fetches fresh secret values at execution time through a service connection, and rotation in the vault is picked up automatically. The pipeline sees a variable name; the value never persists in the definition.
This integrates cleanly with the Key Vault RBAC model: the pipeline's service principal gets the Key Vault Secrets User role scoped to the vault, and nothing more. If that principal is compromised, the blast radius is limited to reading the secrets the pipeline was already authorized to read, and every read is auditable in the vault's diagnostic logs.
# Link a variable group to Key Vault at definition time
variables:
- group: de-secrets # backed by Azure Key Vault vault kv-dataeng-prod
# Then reference secrets as ordinary variables; no value in source control
steps:
- script: |
echo "ADLS account: $(adlsAccountName)"
echo "Using secret of length ${#adlsAccessKey}"
displayName: Consume injected secrets
env:
ADLS_KEY: $(adlsAccessKey)
Branch policies, environments, and approvals
Branch protection is the first line of release quality. Require pull requests with at least one reviewer, require the build to pass, and block direct pushes to main. For data platforms, add a policy that any change under infra/ or pipelines/ triggers the full validation stage, because a Bicep parameter change can be as impactful as an application code change.
Deployment environments carry the second line: approval checks, access restrictions, and deployment history. Production environments should require explicit approval from the owning team, and the approval record doubles as your change-management evidence for audits. Gates can run health checks between stages, such as verifying that the previous pipeline run in prod was green before allowing a new deployment to proceed, which prevents stacking a risky release on top of an already-degraded system.
Rollback when the data plane is involved
Rollback for data platforms is subtler than redeploying the previous artifact. If a release changed a pipeline's output schema, the previous artifact will happily write the old schema while downstream consumers expect the new one, and the data written in between is already inconsistent. The safe pattern is: stop the pipeline first, assess whether data landed in a bad state, remediate or quarantine the bad partitions, then redeploy the previous artifact. Automation should encode the stop, but the remediation decision stays human.
For infrastructure, Bicep deployments are tracked by deployment name, so redeploying the previous successful template is straightforward. Keep the artifacts from every successful release; rolling back to "the version we think was good" without an artifact is how rollback turns into a second incident.
Testing data logic, not just pipeline syntax
Infrastructure validation catches broken templates, but it does not catch a transformation that quietly drops rows when a source adds a column. Data platform testing lives in three layers. Unit tests exercise pure transformation functions in Python or SQL with fixture data and run in the build stage in seconds. Data quality checks, executed with a framework like Great Expectations or dbt tests, validate row counts, null rates, and referential integrity against real tables in the dev environment after deployment. And regression tests compare output distributions against a known-good snapshot, which is the only layer that catches a join that produces plausible but wrong numbers.
The pipeline shape that supports all three is a validation stage in dev that gates promotion to prod. If the post-deployment data quality checks fail in dev, the release stops before production is touched, and the failure is attributed to the commit that caused it rather than discovered by a business user the next morning. Encoding the checks as code in the repository keeps them reviewable and keeps them from drifting away from the pipeline logic they protect, which is the same discipline application teams apply to test coverage.
Common Mistakes
Hardcoding subscription IDs and secrets directly in YAML
Fix: Use variable groups linked to Key Vault and service connections scoped per environment so values are injected at run time
Hand-editing resources in the portal after a release
Fix: Treat every portal change as an outage of the IaC process; make the change in Bicep and redeploy so drift stays visible in pull requests
Rolling back a pipeline artifact without stopping it first
Fix: Stop the pipeline, assess and remediate any inconsistently written data, then redeploy the previous artifact
Skipping approvals on production because they slow delivery
Fix: Keep approvals on production and move speed to automated validation; approvals are your audit trail and your last chance to catch a bad parameter
Best Practices
- Require pull request reviews and passing builds on main through branch policies
- Publish ARM or Bicep artifacts from the build stage and promote the same artifact through every environment
- Link variable groups to Key Vault so rotation needs no pipeline edit
- Configure environment approvals on production and treat the approval log as change-management evidence
- Retain artifacts for every successful release so rollback targets are unambiguous
Interview Questions
Q1: How do you implement CI/CD for Azure Data Factory with Azure DevOps?
Enable ADF Git integration for source control, create a build pipeline that validates tests and ARM export, then a release pipeline that deploys infrastructure with Bicep and publishes the ADF ARM template per environment, with approval gates on production.
Q2: What is the difference between build and release pipelines?
Build pipelines compile, validate, and package code and tests into artifacts. Release pipelines consume those artifacts and deploy them to environments using deployment jobs with strategy, approvals, and environment protection. Keeping them separate ensures the tested artifact is the deployed one.
Q3: How do you handle secrets in Azure DevOps?
Store them in Azure Key Vault and link a variable group to the vault, granting the pipeline's service principal the Key Vault Secrets User role. Secrets are injected at run time and never appear in YAML or repository history, and vault diagnostics provide an audit trail of every read.
Key Takeaways
- Parameterize environments through Bicep and variable groups so promotion is an artifact move, not a re-export
- Keep deployment stages thin: infrastructure first, data plane second, both from published artifacts
- Key Vault-linked variable groups eliminate secrets from source control and pick up rotations automatically
- Environment approvals on production double as change-management audit evidence
- Rollback means stopping the pipeline, remediating bad data, then redeploying a retained artifact in that order