Short answer: connect only the development Data Factory to Git, work on branches and merge through pull requests, and let a build turn the main branch into an ARM template. A release pipeline deploys that same template to test and then to production, each with its own parameter file, and every password lives in Key Vault, not in a linked service.
Changing pipelines straight in the production factory works until the day a change breaks the nightly load and nobody can say what changed, or put it back. Treating the factory like code gives you the answers: the history is in Git, the review is in the pull request, and test runs exactly what production will run.
What does the release path look like?
- 1Brancha feature branch in the dev factory's studio
- 2Pull requesta review, then a merge into main
- 3Buildmain exported as an ARM template
- 4Testthe template deployed with test's parameters
- 5Productionthe same template, production's parameters
Only the development factory is connected to Git. Test and production are never edited by hand: they only ever receive a deployment. That one rule is what makes "it worked in test" mean something.
Which settings change per environment?
Everything that names a place: the server a linked service connects to, the storage account, the Key Vault's address, a trigger's start time. Data Factory turns these into ARM template parameters, and each environment gets its own value.
- sql-dev.database.windows.net
- kv-data-dev
- triggers off
- sql-test.database.windows.net
- kv-data-test
- triggers on
- sql-prod.database.windows.net
- kv-data-prod
- triggers on
A parameter file per environment holds those values. Keep it in the same repository, so a new setting is reviewed like any other change.
How do you build the template automatically?
The classic way is the Publish button, which writes the template to an adf_publish branch. The better way is the npm package @microsoft/azure-data-factory-utilities: your build pipeline validates every resource in the main branch and exports the ARM template itself, so nobody has to press Publish and the template always matches the merged code.
- task: Npm@1
displayName: Validate and export the ARM template
inputs:
command: custom
workingDir: $(Build.Repository.LocalPath)/build
customCommand: run build export $(Build.Repository.LocalPath) /subscriptions/$(SubscriptionId)/resourceGroups/$(ResourceGroup)/providers/Microsoft.DataFactory/factories/$(FactoryName) ArmTemplateThe build folder holds a small package.json that depends on the package and defines a build script running node node_modules/@microsoft/azure-data-factory-utilities/lib/index. The release then deploys the exported template with an ARM deployment task.
Where do the passwords go?
In Key Vault. A linked service that holds a password or a connection string carries it into Git and into every template. Instead, give the factory's managed identity read access to secrets in the environment's Key Vault, and point the linked service at the secret's name. The template then holds only the vault's address and the secret's name, both of which are safe to review.
What goes wrong?
- A deployment while triggers run. Deploying over a running trigger fails or leaves it half changed. Stop the triggers before the deployment and start them after; Microsoft's sample pre- and post-deployment script does exactly that.
- Someone edits test by hand. The next release overwrites it, and the fix is gone. Lock test and production down to the deployment's identity.
- A parameter missing in one file. The deployment uses the development value, and production quietly reads from the development server. Review the parameter files with the change that added the parameter.
Where can you check this?
- Microsoft Learn: Source control in Azure Data Factory
- Microsoft Learn: Continuous integration and delivery in Azure Data Factory
- Microsoft Learn: Automated publishing for continuous integration and delivery
- Microsoft Learn: Store credentials in Azure Key Vault
Where do you start?
Connect your development factory to a repository first, even before the build: the history and the pull requests are worth it on their own. The pipelines from Your first metadata-driven pipeline make a good first thing to release this way, and the pattern sits on the map of my work next to the others.