Search code examples
powershellazure-devopsazure-cliazure-repos

How to set "reset all code reviewer votes" in Azure Devops using CLI


Currently trying to automate branch policy creation in AzureDevOps using the Azure CLI with Windows Powershell, is there a way to enable "Reset all code reviewer votes" when new changes are applied through the CLI?

currently have the following:

 az repos policy approver-count create --allow-downvotes false --blocking true --branch dev --creator-vote-counts true --enabled true --minimum-approver-count 1 --repository-id $repoID --reset-on-source-push true

and so far it only ticks/enables the "Reset all approval votes (does not reset votes to reject or wait)" option

Thanks in advance!


Solution

  • Hi one of the options is to use Azure DevOps REST API of Policy Configuration, however you need to construct JObject arrays and use PUT Request.

    what you need is on the resetOnSourcePush and maybecreatorVoteCounts

    enter image description here