Service Hooks for pull requests in Azure DevOps send events from Azure DevOps to your own services, thereby triggering follow-on processes. In practice, what matters most is that you choose the right pull request events and define clearly what they mean in your team's workflow.
A Service Hook is an event notification sent to another system, for example to a webhook. In this article, we look at pull requests in Azure DevOps Services and how to classify such signals in a technically sensible way.
Depending on the situation, these related topics are often more relevant than the hook configuration itself:
- creating a pull request
- draft pull requests
- linking work items to pull requests
- the size of a pull request
- who may push, merge and bypass rules
- resolving merge conflicts
- squash, rebase or merge commit
- choosing between Azure Repos and GitHub
Which pull request events exist and what they are useful for
For day-to-day operation, the number of events matters less than what they actually tell you. An event is suitable for automation if your service can derive a clear next action from it.
A useful way to group them is by business signal:
- a pull request is created or updated
- its state changes towards completion or abandonment
- an external checkpoint reports a status back
- discussions and comments change
Not every category is equally useful. Comments are often relevant to people, but as triggers for machine logic they are usually too imprecise. Events closer to a decision are more dependable, for example when the pull request as a whole changes or when a status signal is set.
A status signal is a machine-readable check result on a pull request. In Azure Repos, such a status can act as a required policy if you wire it in accordingly. Microsoft Learn describes which rules Azure Repos supports in “Branch policies overview” and “Branch policies”, accessed on 01/11/2026: including a minimum number of reviewers, linked work items, comment resolution, build validation and status checks; all disabled by default.
That means the same event can carry different weight depending on the target branch. For main, Microsoft recommends in “Securely use repositories and pull requests in Azure Repos”, accessed on 01/11/2026, among other things restrictive permissions for bypassing policies, two reviewers, linked work items, comment resolution and build validation.
If you want to evaluate results from external checking services reliably later on, keep planning, change history and measurements clearly separate: functional changes, measurements from real runs and, for planned services as well, sign-up and subscription model in development.
Planning subscriptions for webhooks, Service Bus and Azure Functions
From a technical point of view, Service Hooks can be connected to different kinds of target. For your architecture, however, the decisive question is less the target type itself than whether you want a directly reachable HTTP target or a decoupled hand-off with buffering in between.
A webhook is the direct option: Azure DevOps sends the event straight to an HTTP endpoint in your service. That is easy to follow for small integrations and is often a good place to start. In return, the receiving service must be properly secured, reachable and manageable when things go wrong.
A Service Bus is more suitable for a more robust chain. In that case, the event is not processed in business terms immediately, but first placed in a messaging infrastructure. That helps with load spikes, maintenance windows, or when several consumers need to react to the same pull request events. A queue is a buffer for messages between sender and recipient.
Azure Functions are useful as a lightweight intermediate stage. They can accept HTTP events directly or process messages from a queue further downstream. This is useful if you want to separate routing, normalisation and preliminary checks from the actual business service.
It usually makes sense to split subscriptions not only by event type, but also by business relevance. That way, not all pull request activity burdens the same downstream system. For one process, creation, update and completion are often enough, while comments or individual review changes are handled separately.
Another important point is this: the payload alone often does not fully support your decision. Many recipients also look up additional details via the Azure DevOps API, such as the current policy state, linked work items or other artefacts.
For pull requests, a multi-stage flow is therefore often more dependable:
- receive hook
- validate minimally
- persist message
- process asynchronously
- report the result back as a status check or into a connected system
If you separate hook processing and policy management organisationally, one further point matters: branch policies can be managed via the REST API or with az repos policy commands. Source: Microsoft Learn, “Branch policies” and “Branch policies overview”, accessed on 01/11/2026.
Securing the receiving endpoint

Treat the hook endpoint as a small reception area, not as the place where business decisions are made. It should accept requests, check them briefly and hand further processing over to internal components.
In most cases, a few basic principles are enough:
- accept only the expected methods
- limit requests, for example in terms of size and runtime
- do not write secrets into the URL or log text
- check headers and origin against your technical model
- keep responses and error cases clear and brief
A strict separation of roles is also helpful. The identity receiving hooks does not need the same rights as a service that later sets a pull request status or fetches additional data. So assign permissions separately and keep them as limited as possible. For Azure Repos this remains important because Service Hooks do not compensate for permissions that are too broad. For protected branches, Microsoft recommends, among other things, restricting permissions to bypass policies tightly to a small admin group. Source: Microsoft Learn, “Securely use repositories and pull requests in Azure Repos”, accessed on 01/11/2026.
As soon as pull request content leaves your service, you should describe the data flow clearly: what content arrives, what is stored, who may access it and when it is deleted. This often affects source code, comments, identities and links to work items.
That regularly touches on data protection, data processing agreements, DORA, the NIS2UmsuCG and, where applicable, questions of co-determination. Clarify this with your data protection officer and legal advisers; where monitoring effects are possible, the works council may also become relevant at an early stage.
Idempotency, retries and robust processing

Build hook recipients as if events could arrive late, more than once or in quick succession. That is exactly what separates a demo from an integration chain you can steer reliably in production.
Idempotency means that a processing step produces no different result when repeated with the same business input than it did the first time.
In practice, this starts with clean capture of every incoming event. To do that, store stable attributes, for example:
- pull request ID
- event type
- timestamp
- your own processing identifier
That makes deduplication, restart and traceability much easier.
The business rhythm of a pull request matters as well. A single process can trigger many updates in a short period: new pushes, new comments, changed reviewer votes or new build results. If your downstream starts the same full flow again for every hook, you can easily create unnecessary load and side effects that are hard to explain.
Asynchronous processing with a persisted queue is usually more robust than direct business logic inside the webhook request. This makes timeouts, retries and load spikes easier to control.
Try not to rely on a perfectly ordered event chain. A state-oriented approach is more sensible: when in doubt, the service fetches the current state of the pull request and decides on that basis rather than on an assumed sequence of individual notifications.
Comments and human reviews are not always a good trigger for machine logic either. A pull request status as a separate checking channel is often more stable because it can clearly be fulfilled, failed or pending.
If you also connect additional AI review or other automated checks, you will need fallbacks for exclusions and limits as well. For Copilot Code Review, Microsoft mentions, among other things, only active pull requests without merge conflicts, as well as size and parallelism limits. Source: Microsoft Learn, “Copilot code reviews”, accessed on 01/11/2026.
Frequently asked questions
Which events provide the clearest business starting point for pull request automation?
Useful events are those that change the state of a pull request unambiguously. These chiefly include creation, relevant updates and the transition to completed or abandoned.
Signals from ongoing review conversations are less clear-cut. Individual comments or vote changes matter to people, but as a starting point for automation they are often too inconsistent.
So for each event, ask a simple question: does it lead to exactly one technical follow-up step or not?
Is an external review service enough as a mandatory check before merge?
Yes, if you return its result as a pull request status and use that status as a required policy. A status is a machine-readable check result on a pull request.
For governance, one point matters: not every review signal has the same effect. According to Microsoft Learn, “Review pull requests”, accessed on 01/11/2026, Copilot Code Review always leaves a Comment review. That does not satisfy a Required Reviewer policy and does not block the merge.
So if you want binding effect, you should clearly distinguish between comment, reviewer vote and status check.
What changes if you build preview features into the chain?
Preview mainly means planning effort. According to Microsoft Learn, “Sprint 279 Update”, accessed on 01/11/2026, Copilot Code Review in Azure Repos is a Public Preview; preview features have no SLA and may change.
For operations, that usually means:
- document assumptions
- carry limits and exclusions along
- provide failure and fallback paths
- keep track of changes in the documentation
That applies in particular when a hook does more than inform and also triggers further checks.
Does Azure DevOps Server play the same role as Services for these hook and AI scenarios?
No, you should consider them separately. For this topic, several current AI-related functions initially run only in Azure DevOps Services. According to Microsoft documentation, checked on 24/10/2026 and read again on 01/11/2026, Azure DevOps Server is not at the same level here; a planned service such as Polier is also in development, not yet available, and not intended for Azure DevOps Server before 2027.
Next step
For pull request hooks, first define your operational boundary: what should merely notify, what should decide, and what may indirectly prevent a merge? That exact separation makes later changes to policies, checks and responsibilities easier to manage.
A short definition of three points is helpful:
- business purpose of the signal
- responsible target system
- effect back on the pull request, for example informational only or required status
Track changes to hook subscriptions and branch policies in a traceable way. As cloud documentation and feature states can change, you should always record the version you read.
If a planned service for Azure DevOps Services is relevant to you: as of 01/11/2026, Polier is in development and not yet available.