MicrosoftDocs / vsts-rest-api-specs

MIT License
169 stars 116 forks source link

Set Policy Configuration with API #257

Open ZClifton-21 opened 5 years ago

ZClifton-21 commented 5 years ago

Is there any way to create and mange branch policy other then the Web interface? We would like to be able to control our branches through the API so automation can handle setup and removal for us. https://docs.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

pollockm commented 5 years ago

I am also attempting to do this, and would love to be able to remove an annoying manual step in our setup process.

crystalgeek commented 5 years ago

You can make post requests against https://dev.azure.com/$Organization/$ProjectId/_apis/policy/configurations?api-version=3.2 - Check in your Developer Tools to see the data being posted from the web when you modify your policies to get an idea of the Post data you need.

crystalgeek commented 5 years ago

Actually - https://docs.microsoft.com/en-us/rest/api/azure/devops/policy/configurations/create?view=azure-devops-rest-5.1

MisinformedDNA commented 3 years ago

@goflores What work is this tracking? It seems like it's already been answered.

Stepness commented 12 months ago

Configuration file for Azure Devops policies still lacks documentation of properties. The closest automation we have is creating a script that uses az cli to setup policies for repositories.