The code can be utilised to create repository in azure devops and then on top of it applies branch folder restriction for feature or bug branch and restrict contributors to do changes on main branch
The Yml pipeline can be run to using a system.accessToken in azure devops to create repository and apply branch folder restriction policy for contributors to only work with feature and bug branch.