Target workflow
feature branch → PR to main (review) → build (validate + export ARM) → deploy test → approval → deploy prod
Only the dev factory is connected to Git. Test and prod factories are deployed by the pipeline; nobody edits them in the UI.
1. Connect dev to Git
ADF Studio → Manage → Git configuration: repository, collaboration branch main, root folder /adf. Import existing resources from the dev factory into the repo on first setup.
Turn on "Disable publish" in the Git settings once automated builds work, so the UI publish button can't bypass CI.
2. Parameterise environments
Everything that differs per environment must be a parameter or a Key Vault reference:
- Linked service URLs, server names, Key Vault base URLs.
- Integration runtime names.
- Global parameters.
Use a custom arm-template-parameters-definition.json if you need extra properties parameterised.
3. Build: validate and export
package.json in the build folder:
{ "scripts": { "build": "node node_modules/@microsoft/azure-data-factory-utilities/lib/index" },
"dependencies": { "@microsoft/azure-data-factory-utilities": "^1.0.0" } }
Azure DevOps build steps:
- script: npm install
workingDirectory: build
- script: npm run build validate $(Build.Repository.LocalPath)/adf /subscriptions/$(subId)/resourceGroups/rg-data-dev/providers/Microsoft.DataFactory/factories/adf-dev
workingDirectory: build
- script: npm run build export $(Build.Repository.LocalPath)/adf /subscriptions/$(subId)/resourceGroups/rg-data-dev/providers/Microsoft.DataFactory/factories/adf-dev "ArmTemplate"
workingDirectory: build
- publish: build/ArmTemplate
artifact: adf-arm
4. Deploy with trigger handling
- Run the Microsoft-provided
PrePostDeploymentScript(pre-deployment) — it stops triggers. - Deploy
ARMTemplateForFactory.jsonwith environment parameters:
az deployment group create -g rg-data-prod --template-file ARMTemplateForFactory.json \
--parameters @ARMTemplateParametersForFactory.json factoryName=adf-prod \
ls_adls_properties_typeProperties_url=https://stdataprod.dfs.core.windows.net/ \
ls_keyvault_properties_typeProperties_baseUrl=https://kv-data-prod.vault.azure.net/
- Run the script again (post-deployment) — it deletes removed resources and restarts triggers.
Warning
If the post-deployment step fails, triggers stay stopped and pipelines silently stop running. Fail the release when that step fails, and verify trigger state at the end.
5. Secrets
No secrets in ARM parameters. Linked services reference Key Vault; each environment's factory managed identity has access to its own vault.
6. Hotfixes
Fix in a branch from main, PR, and release through the same pipeline — never edit prod. If an emergency edit happened in prod, copy it back to dev/Git immediately or the next deployment overwrites it.
Checklist
- Dev factory in Git; publish disabled in UI
- Environment values parameterised; secrets in Key Vault
- Build validates and exports ARM on every PR/merge
- Release with pre/post scripts and trigger verification
- Test and prod UI edit rights removed