Branch control in Azure DevOps environments seems broken

DH 0 Reputation points
2025-05-22T09:56:32.56+00:00

We use YAML pipelines. In our deployment jobs, we reference Azure DevOps environments. In ADO environments, we defined Branch control rules. E.g. refs/head/main is allowed in the ADO environment EU_int . If the YAML pipeline is triggered by the main branch , the run is allowed. If I execute the same pipeline with another branch, Azure DevOps reports "Branch control failed". It worked well for months. And suddenly stopped to work. We didn't change anything. The pipeline is triggered by the main, the correct ADO environment EU_int is used (refs/head/main is allowed there), and we gett "Branch control failed"

Any idea?

Azure DevOps
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Durga Reshma Malthi 11,590 Reputation points Microsoft External Staff Moderator
    2025-05-22T10:41:45.84+00:00

    Hi DH

    I wanted to clarity if you mentioned refs/head/main or refs/heads/main. As I believe refs/head/main is incorrect.

    In the YAML file, ensure that the trigger section correctly mapped to refs/heads/main, not just main

    trigger:
      branches:
        include:
          - refs/heads/main
    

    Also try to remove & re-add the branch control and test it again
    In branch control you can allow combination of branches by comma: refs/heads/main, refs/heads/<another branch>

    Additional References:

    https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass

    Hope this helps!

    Please Let me know if you have any queries.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.