Automation

Azure DevOps Service Hooks: diagnose probation before recreating a webhook

A production runbook for separating event generation, filters, delivery, receiver failures and missed events when an Azure DevOps service hook enters probation.

26 Oct 2026 azureazure-devopsservice-hookswebhooksdevopsautomationobservabilityincident-responseidempotencysecurityrunbookrollbackproduction

A deployment completes in Azure DevOps, but the change-management workflow receives no event. Pipelines are green, the receiver answers a direct health check, and recreating the webhook looks faster than investigating an invisible queue.

That replacement can lose the only useful delivery history and create a second active subscription while the first one is still retrying. It also does nothing when the event no longer matches the subscription filter. A service hook incident must be split into four stages: Azure DevOps produced the event, the subscription selected it, the delivery request reached the consumer, and the consumer processed it exactly once.

The running case is a release.deployment.completed or pipeline-stage event sent to an HTTPS automation endpoint. The receiver creates a change record and may start a follow-up job. The runbook ends with one bounded decision: restore the existing subscription, keep it contained while the receiver is repaired, replace it under controlled ownership, or reconcile missed events without replaying successful actions.

Freeze the subscription and downstream effects

Start with the subscription ID, not only its display name. Record the last event known by the source, the last event accepted by the receiver and the first gap. Pause any manual bulk replay until the downstream system can reject duplicates.

yaml 01-service-hook-incident.yml
incident: INC-AZDO-918
window_utc: 2026-10-26T05:30:00Z/2026-10-26T07:00:00Z
organization: contoso-platform
project: delivery
subscription_id: 11111111-2222-3333-4444-555555555555
expected_event: release.deployment.completed
consumer: change-automation-prod

observed:
pipeline_completed: true
receiver_last_event_utc: 2026-10-26T05:42:18Z
subscription_status: probation

containment:
subscription_deleted: false
replacement_created: false
bulk_replay_blocked: true
receiver_writes_guarded_by_event_id: true

preserve:
- subscription_status_and_filters
- delivery_history_without_secrets
- source_run_and_deployment_ids
- receiver_access_and_application_logs
- downstream_action_ledger

Probation is not a passive warning. During probation, the subscription can lose new events while Azure DevOps retries the failed notification. Recovery therefore has two tracks: repair future delivery and reconcile the events that never entered the delivery path.

Read the effective subscription without exposing credentials

Use the Service Hooks REST API or the Project settings page to capture the live object. Source configuration is useful, but it does not prove that the deployed subscription still has the same filters, URL or owner.

bash 02-inspect-service-hook.sh
ORG="contoso-platform"
SUBSCRIPTION_ID="11111111-2222-3333-4444-555555555555"

curl --fail --silent --show-error \
--user ":$AZDO_PAT" \
"https://dev.azure.com/$ORG/_apis/hooks/subscriptions/$SUBSCRIPTION_ID?api-version=7.1" \
| jq '{
  id,
  status,
  publisherId,
  eventType,
  publisherInputs,
  consumerId,
  consumerActionId,
  endpoint: .consumerInputs.url,
  probationRetries,
  lastProbationRetryDate,
  createdDate,
  modifiedDate,
  createdBy: .createdBy.displayName
}'

Use a short-lived credential with the minimum required scope and keep it outside shell history. Do not export all consumerInputs: they can include authentication material. Capture only the endpoint identifier and non-secret delivery settings needed for the incident.

Check four kinds of drift:

  • the event type changed from release deployment to YAML pipeline stage or run;
  • a project, pipeline, branch, environment or result filter no longer matches;
  • the consumer URL, authentication or TLS policy changed;
  • the subscription owner left the project or the status is disabled, probation or restricted.

Prove that the source event exists

A successful test notification proves that the consumer can receive a synthetic request. It does not prove that a real build, release or pipeline stage matches the publisher filters.

Take one missing action and retain its run ID, deployment ID, project, definition, stage or environment, result and completion time. Then compare those values with eventType and publisherInputs. Event families that sound similar do not share the same contract: a classic release deployment completion, a build completion and a YAML run-stage state change are distinct events.

If Azure DevOps has the source record but the subscription history has no notification, focus on event type, scope and filters. If history shows filtered, do not troubleshoot the receiver. Correct the selection contract and generate one bounded canary event.

Read delivery history before changing the endpoint

Notification history contains the event identifier, result, status, attempt count, duration and, when details are retained, the request and consumer response. Start with metadata and disclose payloads only through the approved incident store.

bash 03-list-service-hook-notifications.sh
ORG="contoso-platform"
SUBSCRIPTION_ID="11111111-2222-3333-4444-555555555555"

curl --fail --silent --show-error \
--user ":$AZDO_PAT" \
"https://dev.azure.com/$ORG/_apis/hooks/subscriptions/$SUBSCRIPTION_ID/notifications?maxResults=100&api-version=7.1" \
| jq '.value[] | {
  id,
  eventId,
  createdDate,
  status,
  result,
  attempts: .details.requestAttempts,
  duration_seconds: .details.requestDuration,
  error: .details.errorMessage
}'

Classify what the history proves:

  • no notification for a known source event points to scope, event type or filter evaluation;
  • filtered confirms that delivery was intentionally skipped;
  • failed with 401 or 403 points to the receiver authentication or authorization contract;
  • 404 points to path or deployment drift, not network reachability;
  • 408, 502, 503 or 504 triggers transient retries and usually points to latency or availability;
  • 410 Gone is terminal and disables the subscription;
  • other persistent HTTP failures can move the subscription into probation.

Azure DevOps retries transient failures over a short increasing interval. Enduring failures enter a longer probation sequence. Do not add another retry loop at the receiver without considering these platform attempts and the receiver’s own queue.

Trace matching and delivery for a bounded window

When normal history is insufficient, enable subscription diagnostics temporarily. Evaluation tracing explains why an event did or did not match; delivery tracing explains how the notification was sent. Keep the window short because diagnostic retention is intentionally bounded.

bash 04-read-subscription-diagnostics.sh
ORG="contoso-platform"
SUBSCRIPTION_ID="11111111-2222-3333-4444-555555555555"

curl --fail --silent --show-error \
--user ":$AZDO_PAT" \
"https://dev.azure.com/$ORG/_apis/hooks/subscriptions/$SUBSCRIPTION_ID/diagnostics?api-version=7.1" \
| jq '{evaluationTracing, deliveryTracing, deliveryResults}'

Diagnostics should answer one question in one canary window. Disable extended tracing after evidence is collected, and do not copy full payloads into chat or tickets: work item text, repository metadata and authentication headers may be sensitive.

Qualify the receiver as a production consumer

Test the exact HTTPS path from outside the receiver’s private network. Azure DevOps webhooks require a reachable HTTPS endpoint; a health check from inside the application VNet does not prove that the service can reach it. If the receiver is protected by a firewall or proxy, verify the documented Azure DevOps ingress path and the evidence at that boundary.

Separate transport from processing:

  • DNS, TCP and TLS must reach the expected listener with a trusted certificate;
  • authentication must identify the subscription without embedding durable secrets in logs;
  • the POST route must accept the expected content type and payload version;
  • the handler must return promptly and move slow work to a durable internal queue;
  • the event ID or source resource ID must act as an idempotency key;
  • receiver logs must correlate event ID, subscription ID and downstream action ID.

A 200 that is returned before durable acceptance can lose work. A 500 returned after the action already committed invites a retry and duplicate side effects. Define the acknowledgement boundary explicitly.

Repair first, then test one real event

Fix the narrowest demonstrated cause: restore the endpoint route, certificate chain, authentication reference, capacity or filter. Keep the existing subscription so its identity and history remain observable. A successful delivery while the subscription is on probation can return it to an enabled state; verify the status instead of assuming recovery.

Run two canaries:

  1. Send a test notification to validate the consumer contract without a production action.
  2. Generate one real source event that matches the production filter and has a no-effect or isolated downstream target.

The second canary is essential. It validates publisher, filter, delivery and receiver together. Confirm one source event, one notification, one durable acceptance and one downstream result.

Reconcile the events missed during probation

Events published while the subscription was losing new events need a separate reconciliation. Query the authoritative source for runs or deployments in the incident window and compare their stable IDs with the receiver ledger.

text 05-reconciliation-contract.txt
SOURCE INVENTORY
run or deployment ID
project and definition
stage or environment
completion time and result

RECEIVER LEDGER
source resource ID
service hook event ID when available
accepted timestamp
downstream action ID and final state

REPLAY GATE
source event is inside the incident window
no successful downstream action exists
target state is still applicable
dry run shows the exact intended change
replay carries an explicit incident and idempotency key

Do not blindly resend captured HTTP bodies. Their credentials, URLs or business state may be stale. Prefer a reconciliation command that reads the current source object, prepares the action in dry-run mode and writes only when the ledger proves a gap.

Decide, validate or roll back

Restore the existing subscription when its ownership and contract remain valid and the failure is confined to the receiver. Replace it only when the object is irreparably misowned or corrupted; disable the old subscription, canary the new one and keep a rollback window without two active writers.

Hold delivery when the receiver cannot guarantee idempotence or the missed-event inventory is incomplete. Reconcile only proven gaps. Roll back the receiver or filter change when the incident began with that deployment and the previous contract remains compatible.

Close the incident only when subscription status is enabled, a real event matches, delivery history shows success, the receiver ledger contains exactly one action, and the probation window has been reconciled. Rollback means restoring the previous endpoint or filter, disabling the candidate subscription and stopping replay at the first duplicate or unexplained side effect.

Conclusion

An Azure DevOps service hook failure is not just a broken webhook URL. It is a production event chain with selection, delivery, acknowledgement and idempotence boundaries.

Preserve the existing subscription, prove the source event and filter, classify notification history, repair the receiver, then validate one real canary. The final decision is explicit: restore, hold, replace or reconcile, with duplicate prevention and rollback kept active until every missed event is accounted for.