I would like to enforce a policy on my Pull Requests in Azure Devops (using Azure Repositories) to only allow a PR to be complete IFF the build definition succeeds. Based on this documenation: https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies?view=azure-devops and what I have tested so far the builds only trigger after the PR is marked complete. So in the event that a build failure occurs, the broken code makes it into the master (or target branch). I'd like to disable the ability to complete a PR until the Build Succeeds. This was possible in Team Foundation Server but I have not been able to set this up in Azure Devops.
I have reviewed the Branch Policies section and it is clear how to require a review/approval from a member of a specific group prior to allowing the PR to be marked Complete. So the hooks seem to exist, however, I have only been able to trigger a build definition AFTER the build is marked Complete.
Require a certain build to run with your PR
The "Build Validation" section of the link you mentioned does exactly what you describe.
edit: this is how it looks like afterwards:
Require a certain user to review/approve
Look at the section "automatically include code reviewers".