hi friends welcome to offer studies YouTube channel this is part 46 in Azure data Factory real-time scenarios playlist in this video we are going to discuss about how we can not allow users to perform any kind of edits on top of the collaboration Branch so you know that if you haven't seen my data Factory video playlist please watch them in which there is a video where I explained about connecting your data Factory with Git enabled repository in Azure devops okay so if you watch that video then you will get more idea about what is collaboration
branch and what is git repo and everything okay so this video is a practical video so I will not go in detail about explaining all this so please watch that so for now you get idea that collaboration branch is something like a main branch where your data Factory will be connected and for example if you have this branch and you want to perform any kind of updates or edits or new implementations you will create a new branch called worker Branch or future branch and finally this will change these changes will be merged into your collaboration
Branch using PR process pull request process okay so I explained all this in my git enabled repo video related to data Factory in Azure data Factory playlist so please watch that so in real time what will happen is when you have a collaboration branch and in which the data Factory code will go then we should not allow people to directly perform any kind of Errors there for example they want to implement a new pipeline what they ideally should do they will create a new Branch from here and we will call it like a worker Branch
or future branch and then on that worker our future Branch they will add the new implementations and finally merge the changes back to collaboration Branch using the pr process so this is the best practice is so accidentally people may try to add their changes into collaboration Branch directly so we want to avoid that so how to avoid that what kind of changes we should do it to do that that's what we are going to see in this video so let's go back to my browser so this is my Azure devops account the first studies is
organization name in this I have a project called Azure data Factory project so let's go inside and here if I go to repost I have one repo called Azure data Factory repository so let's try to create another Ripper and let me name it like a demo triple okay and let me hit create button to create this repository okay so now if I go to demo repo you can see I have a main branch here okay and I have only one branch at this moment so let's assume we want to connect data Factory with this branch
and we want to treat this Branch as a collaboration Branch so let's do that setting first so let me go to data Factory and here let me go to manage and here if I scroll down I can see git configuration option so here I can hit this configure button to configure my git repository so I am selecting devops git and then here I I am selecting my directory and when I hit continue it is going to ask me select a repository or use the repository link so I have a ripper so I am selecting that
organization name here it is the same Arc you can see buffer status and then in which I have a project called Azure data Factory project you can see it's a same project and then here so let me try to select that demo repository with this repository I am trying to connect this data Factory and here collaboration branch is a main branch so as I said my repo has a main branch right so this main branch I want to use it as a collaboration branch that means all the changes should finally be in this Branch okay
and the ADF published branch is the branch where after build the arm templates will get create you know this already from my data Factory playlist cacd video and also from the connecting ADF to git repo video okay so please watch if not and here I can select like keep my resources into main branch and import all the resources from the data Factory whatever we have right now into my branch and repo that's what these all settings are so when I hit apply it is going to configure a repository with my data Factory and that repository
is going to be demo repository so that is the repository I am configuring with my data Factory so let's wait for the configuration to complete here okay git repository configured successful it is telling whether you want to open this ADF with that Branch or not yes use that let me hit save button so now finally if you see under git configuration I can see my configuration information I connected to demo repository and Main is a collaboration Branch now if I go to this main branch and if I refresh this here I should see some folders
created there you can see from where these folders and this integration runtime folder everything came because I connected my data Factory with this branch and repo so automatically all the artifacts whatever we have right now it replaced it here and created a folders accordingly no need to worry this so right now we don't have any pipelines here so let's assume in reality uh once you do this configuration once you do this collaboration Branch configuration you want to ask your developers to start create a pipelines so what ideally they should do is from this main branch
they should create a new Branch right now I am under a main branch I should create a new Branch once I create a new Branch it will take all the code from the main branch and it will copy into the new Branch as well so that means you have identical code in the main branch and New Branch now that new Branch whatever you created it's a worker Branch or a future Branch so on that Branch you should ideally start working so that's how it should be so we should keep this Branch logged that means no
one should able to do any kind of alerts here I mean any kind of edits here okay so that's how you have to maintain all the edits should happen in New Branch and then finally create a peer to merge the changes into the main branch so that is the ideal process so you know this if you have seen my previous videos as I said but now right now right if I add anything it will still allow so let me try to create a new pipeline here under main branch and the pipeline one so it's a
simple pipeline I am using a weight activity here so let's assume this is my pipeline let me save button one side save button it is saving all these changes into the main branch you can see it is successfully saved also if I go to git repo and if I refresh this here I should see that see there is a new folder called pipeline now in beam branch and I can see my pipeline1.json also so that means I am able to directly perform my development on Main Branch are my edits on Main Branch so that should
not be the case so ideal case should be so let's assume right now this is Main Branch so from here some developer 1 has to come and start developing a new pipeline called pipeline tool so what they should do is they should create this new Branch here and they can name it like maybe Mahir working Branch okay based on the main branch let me hit create button it will take all the code from main branch and place it in a Mahir working Branch as well so once that Branch created your ADF will be connected with
that Branch you can see here right now it is loading it is connected with it and even in the Mahir working Branch I can see my pipeline one so once you do it like this from here you should be able to create a new pipeline so let I'm adding a new pipeline called pipeline 2 and let me take weight activity only and let me hit save button so once I hit save button all these changes will be saved into my future Branch so if I go back here and if I go back to my branches
so let me go back to my branches and here you can see this Mahir working branch and here inside pipeline I have two pipelines but if I go back to my main branch let me go back to here branches and if I go to main branch I can see here only one pipeline that means I was able to do the development here in Mahir working Branch once you done with your development you can create a pull request like this so it will create a pull request it will add title so adding pipeline pipeline to if
you want to change it change it add a description blah blah blah if you want to add some review reviewers also you can do that let me hit create button to create this PR so now this PR will take the changes from Mahir working Branch into main branch so someone should need need to approve this PR so let me hit myself approving myself here so let me hit this approve button to approve that so if you can see here I approved okay then let me try to hit this complete button to complete this match and
let me hit complete to complete this made so I completed my mesh process as well so uh now so in real time someone will review actually but that's fine so now you can see that Branch also would have deleted here and if I go back to main branch I will be seeing my second pipeline as well here so let's wait for the resources to load here and you can see pipeline 2 also came here so this is how it should be so now someone if they try to develop pipeline 3 here directly or someone try
to edit something here it should not allow so for that what we need to do is we need to go to branches so main branch is our collaboration Branch right so here you need to go to Branch policies and under Branch policies you make sure to enable this require minimum number of reviewers okay and then remove you can change it to one whatever it is but remove this allow requesters to approve their own changes you should not keep this checkbox also and keep some number here as a minimum reviewers so that means what I am
saying if you try to do anything on a main branch you he needs some reviewers but when you directly do there if you don't do by PR then it will never allow why because that's how the setting works right so now these settings are enabled so now let me refresh here to make sure settings are there so I am just refreshing it here and I can see it is enabled now if I try to do some edits in main branch so maybe I am adding a new pipeline pipeline 3 and here I am adding a
weight activity now if I try to save this it will never save it will fail it will say you don't have permissions to save any changes directly onto the main branch it should go via PR process only okay so that's the reason we added reviewers and all if you have reviewers and all that means it should come via PR process only so that way in very easily we can avoid any edits on the main branch so definitely they have to undo these changes only to make sure that so and if you want to create in
third python so create a new Branch as I said before and name it like maybe Mahir working Branch or whatever it is that means it's a future branch and once that Branch created try to add your implementations and try to create PR as well as I explained before so that's it in this video so to recall remember this if you want to disable the edits on any branch especially on a collaboration Branch go to branches and grow to Branch policy and then enable this policy require minimum number of reviewers and make sure you don't keep
yourself as a self reviewer so this option should be disabled okay so I hope you got an idea how to not allow edits on a collaboration Branch thank you for watching this video please subscribe to my channel and press the Bell icon to get the notifications whenever I add videos thank you so much