Implementing DevOps for Azure Data Factory
Tags: devops, azure, datafactory, cicd
Published: 2023-10-10 18:04:12

Azure Data Factory is perhaps the most loved one-stop data orchestration platform that is available out there, And it is essentially very important to use ADF along with source control if you are going to deploy it to multiple environments then without having automation it can be very hard to track changes deploy, etc,

Here I am following the below method depicted in the image.


![CI-CD-ADF](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jgozata89zttjko5aptz.png)



So the first thing that I have done is create two Resource groups one for DEV and another for the TEST environment.

Two dedicated resource groups for two environments :


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jarb9c7j0toumqmnlji.png)


Each of the Resource groups contains 1 ADF and 1 Blob :


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fla4s8l1l98l4gsq0z4f.png)



Now log in to the ADF from the dev environment and connect it to the source control either Azure repo or Github,

Once connected, try to publish your workspace, if you have default settings then an additional *adf_publish *branch will be created which will hold all the ARM templates required to deploy the ADF.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xqbxqxegcr3bwvt92q6s.png)


If you look at the branching strategy we are keeping only the DEV environment under source control all the other environments will not be connected to any repository.

Now if you open the adf_publish branch after successful deployment you may see the brach got populated with all the templates,


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pb3rqilzui0byketysar.png)



Since we have to deploy this same thing to other environments let us design the release pipeline.

In the Azure DevOps Release pipeline, the Artifactory location is given as the adf_publish branch.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4liej15zj45qk9ucvs7n.png)



Now, The next stage is configured which will apply the updated changes to the TEST environment


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2c34noxtrcguxajz00h.png)



if you look while doing these hands-on you must change the parameters by using the override parameters section available in the ARM template deployment task,
what it will do is change the blob connection string to the test environment blob connection string which is a necessary step.

**Pro TIP :**

Rather than using override parameters, you can use the PowerShell/Bash command to override the string,
for example: (Get-Content -Path .\test. txt) -replace ‘string_one’,’string_two| Set-Content -Path .\test. txt

Let’s see everything in action:

In the dev environment ADF, we create a new branch based on the main branch,


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gts8ogcj6bgvvjrpyvdz.png)



Points to note Publish is not possible from this feature branch, Once work is done and validated we will apply the same and create a pull request,


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nm1wqk8sqwk5hlz1ft4h.png)



Once the merger check passes the approver can merge the pull request,


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lkm49qoknkarjpau4hty.png)



Once it is successfully merged we can delete the branch


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gnfn10ti4chbibl380af.png)



Now the updated feature is in the main branch, So we go to the main branch and publish all the changes to VCS, We will get this kind of notification showing to publish is successful,


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/39hdt6bxevbh635dec43.png)



Now if we just go to the Azure DevOps and hit create a release, It will just start creating the updated features and resources in the TEST environment from the DEV environment,


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3zy9hsrm1ugo3igaeiww.png)


after the release pipeline successfully completes you can see changes made in the dev branch reflected in the release branch as well.