How to prevent from directly working and making changes on main (or collaboration) branch in ADF (Azure Devops git mode)?

ArunRaaman 981 Reputation points

Hello There,

I recently started learning and practising ADF; with some difficult and trail & error, I am able to manage configure 'Azure Devops git' over ADF.

But, one thing that I am unable figure out is, how to configure Azure-DevOps-git such that it stops from directly making changes and working over main (or collaboration) branch in ADF (Azure-DevOps-git mode) and further save the changes..

I tried to understand the branch policies within Microsoft documentation, did some changes by Locking the main branch within Azure-DevOps-Git, but, unable to notice any intended effect over ADF (Azure-DevOps-git mode) main branch.

I mean, after locking the main branch in 'Azure-DevOps-Git', am still able to make changes directly over main branch within ADF (Azure-Devops-git mode).

My objective is to 1. work /make changes over feature (child) branch, 2. save changes, 3. perform pull-request, 4. merge changes to main (i.e. collaboration) branch, 5. publish the main branch 6. Trigger to execute the pipeline.

Would anyone help me understand and guide me with the configuration.

Thank you for giving your valuable time and efforts.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
7,128 questions
0 comments No comments
{count} votes

Accepted answer
  1. BhargavaGunnam-MSFT 13,241 Reputation points Microsoft Employee

    Hello @ArunRaaman ,
    Welcome to the MS Q&A platform.

    "Protect the default branch of each repository" is the default option.

    You can add branch protection to protect the default branch of each repository or to protect current and future branches matching a specified pattern.

    For example, by inserting * I’m creating a policy for all the branches in my project:

    To unselect, click on branch policies and update the settings.

    I hope this helps.




    If this answers your question, please consider accepting the answer by hitting the Accept answer button, as it helps the community.

1 additional answer

Sort by: Most helpful
  1. ArunRaaman 981 Reputation points

    Hello There,

    I think I found a way to achieve it; Below are the steps (and screenshots):

    log into Azure DevOps Git >open designated project folder > Project Settings > All Repositories > Policies > scroll down to 'Branch Policies' > (+) create > add branch protection > Branches to protect > select: 'protect the default branch of each repository > Create


    However, I was able to achieve the objective at project level; effecting all the repositories associated with the project.

    These changes in configuration within the 'Azure DevOps Git' shall not let to make changes /work directly on main /collaboration branch in ADF (Azure DevOps Git) mode.

    But, this led to new requirement which is: how to undo the these configuration changes?

    Would anyone help me further? Thank you for your time and efforts!

    0 comments No comments