2.5 Webhooks, Service Hooks & Microsoft Teams ChatOps
Key Takeaways
- Service hooks are event-driven outbound HTTP POSTs configured per project; they fire on events such as build completed, release deployment approval pending and pull request merge attempted.
- GitHub signs webhook deliveries with X-Hub-Signature-256 over the raw request body, while Azure DevOps service hooks are unsigned and must be protected with Basic authentication or a secret URL plus IP allowlisting.
- The Azure Boards and Azure Pipelines apps for Microsoft Teams authenticate as the individual who signed in, so the feed breaks when that person leaves.
- Approvals actioned from a Teams card still enforce the underlying Azure DevOps environment approval permissions.
- Use a GitHub App installation rather than OAuth or a personal access token for the Azure Boards to GitHub connection so AB# work item linking survives personnel changes.
2.5 Webhooks, Service Hooks & Microsoft Teams ChatOps
Documentation tells people what the system does; event-driven integration tells them what it just did. Azure DevOps service hooks and GitHub webhooks push lifecycle events to external consumers, and the Microsoft Teams apps turn those events into approvals and notifications engineers can act on without leaving chat.
Service Hooks, Webhooks & Event-Driven Collaboration
Service Hooks allow external services (such as Microsoft Teams, Slack, Azure Functions, or custom HTTP endpoints) to subscribe to events in Azure DevOps.
+--------------------+ +-----------------------+ +---------------------+
| AZURE DEVOPS | Event | AZURE DEVOPS | JSON | EXTERNAL CONSUMER |
| PUBLISHER | ------> | SERVICE HOOK | ------> | (Teams / Webhook) |
| (Pipelines/Boards) | | (Generates HMAC Token)| | (Validates Digest) |
+--------------------+ +-----------------------+ +---------------------+
Service Hook Architecture
- Publishers: Azure DevOps services that generate events (Pipelines, Repos, Boards, Artifacts).
- Event Triggers: Specific actions that fire notifications:
git.push: Code pushed to a repository branch.git.pullrequest.created/git.pullrequest.merged: PR lifecycle events.build.complete: CI pipeline completed.release.deployment.approval.pending: Release paused awaiting human approval.workitem.created/workitem.updated: Work tracking updates.
- Consumers: Target endpoints that consume event payloads (Microsoft Teams, Slack, Azure Service Bus, Azure Functions, Webhooks).
Webhook Payloads and HMAC Signature Verification
When using generic Webhooks as the consumer, Azure DevOps sends an HTTP POST request containing a JSON payload. To prevent man-in-the-middle tampering, unauthorized payload injection, and replay attacks, Azure DevOps allows configuring a Secret Token.
- Azure DevOps computes a Hash-based Message Authentication Code (HMAC) using SHA-1 or SHA-256 over the raw JSON payload with the shared secret token.
- Azure DevOps places this signature in the HTTP request header (e.g.,
X-Hub-Signature). - The receiving external endpoint calculates its own HMAC digest over the incoming raw request body using the pre-shared secret.
- If the computed digest matches the header signature, the payload is authentic and unaltered. If they mismatch, the receiving endpoint rejects the request with HTTP 401/403.
Microsoft Teams ChatOps for Azure DevOps
Microsoft Teams provides two first-party integrated apps for Azure DevOps ChatOps:
1. Azure Boards App for Microsoft Teams
- Channel Commands: Run slash commands directly in Teams channels:
@azure boards link [project-url]: Connects the Teams channel to an Azure Boards project.@azure boards create: Launches an interactive modal card in Teams to create new User Stories, Bugs, or Tasks.@azure boards query [query-name]: Executes a shared flat query and posts the results into the conversation.
- Interactive Work Item Cards: Displays rich Adaptive Cards when work item URLs are pasted. Users can update status, change assignees, and add discussion comments directly from Teams.
2. Azure Pipelines App for Microsoft Teams
- Channel Commands:
@azure pipelines subscribe [pipeline-url]: Subscribes the channel to pipeline build and deployment notifications.@azure pipelines subscriptions: Displays active subscriptions with options to add branch or stage filters (e.g., filter notifications strictly tostageName = 'Production').
- Interactive Deployment Approvals: When a YAML pipeline deployment reaches an Environment with Approval Checks, the Azure Pipelines Teams app posts an interactive Adaptive Card into the channel.
- Seamless Approval Gate: Designated approvers can review the commit hash, pipeline run details, and release notes, and click Approve or Reject with optional comments directly inside Microsoft Teams. Azure Pipelines immediately resumes the deployment stage upon receiving the authenticated approval webhook.
Service Hook Triggers and Actions Reference Table
| Event Trigger | Event Source | Typical Filter | Target Consumer | Primary Use Case |
|---|---|---|---|---|
build.complete | Azure Pipelines | Pipeline Name, Build Result (Failed) | Microsoft Teams / Slack | Instant engineering alert on broken CI builds |
release.deployment.approval.pending | Azure Pipelines | Environment Name (Production) | Teams (Actionable Card) | Interactive mobile/desktop release approvals |
git.pullrequest.created | Azure Repos | Target Branch (refs/heads/main) | Slack / Teams Channel | Peer review awareness and prompt turnaround |
workitem.updated | Azure Boards | Field Changed (State = Blocked) | Custom Webhook / Logic App | Escalation alert to engineering leads |
git.push | Azure Repos | Branch (refs/heads/main) | External Webhook (HMAC) | Triggers third-party compliance audits or mirror repos |
Webhook Security and Connection Governance
Webhook endpoints are unauthenticated HTTP listeners by default, so the exam expects three controls on every custom integration:
- Signature verification. GitHub signs each delivery with
X-Hub-Signature-256, an HMAC-SHA256 of the raw body using the webhook secret. Compute the digest over the raw payload bytes before any JSON parsing, and compare with a constant-time function. Azure DevOps service hooks do not sign payloads, so protect those consumers with a Basic-auth header or a hard-to-guess URL path plus an IP allowlist. - Replay protection. Persist the delivery GUID (
X-GitHub-Delivery) and reject repeats. Service hooks retry on non-2xx responses, so a slow consumer that returns 500 will legitimately receive the same event several times. - Least-privilege consumers. A webhook receiver that opens work items needs only the Azure Boards scope; do not reuse an organization-wide PAT.
Connection governance differs between the two Teams apps and the Boards-GitHub link:
| Integration | Authenticates as | Governance note |
|---|---|---|
| Azure Boards app for Teams | The user who ran @Azure Boards signin | Personal OAuth grant; the channel loses the feed when that user leaves |
| Azure Pipelines app for Teams | The user who subscribed the channel | Approvals actioned in Teams still honour Azure DevOps environment permissions |
| Azure Boards <-> GitHub connection | A GitHub App installation (preferred) or OAuth/PAT | One connection per Azure DevOps project; the GitHub App survives personnel changes |
Prefer the GitHub App installation for the Boards-GitHub connection: OAuth and PAT connections inherit a single human identity and break the AB# mention linking the moment that account is disabled.
AZ-400 Exam Pitfalls & Traps
- Selecting Project Wiki When Versioning is Required:
- Exam Trap: An exam question requires documentation that must branch alongside source code for versioned microservice releases.
- Answer: Never select Project Wiki. You must select Publish Code as Wiki pointing to the repository's documentation directory.
- Relying Exclusively on Client-Side Git Hooks for Commit Governance:
- Exam Trap: Implementing Husky
commit-msghooks to enforce enterprise commit message standards. - Answer: Client-side hooks alone fail compliance audits because any developer can run
git commit --no-verify. Enterprise enforcement requires Azure Repos PR status checks and build validation policies.
- Exam Trap: Implementing Husky
- Ignoring Webhook Payload Authentication:
- Exam Trap: Validating incoming Azure DevOps webhook payloads by checking the
User-Agentheader or basic IP allowlisting. - Answer: User-agent headers are easily spoofed. The cryptographically secure approach is HMAC signature verification using a pre-shared secret token.
- Exam Trap: Validating incoming Azure DevOps webhook payloads by checking the
A DevOps team integrates Azure Pipelines with Microsoft Teams for ChatOps. An engineering manager needs to approve a deployment to the production environment directly from Microsoft Teams without opening a web browser. Which combination of features enables this workflow?
An organization configures an Azure DevOps Service Hook to send automated Webhook POST notifications to an external compliance API whenever a code push occurs. To ensure security, how should the receiving external API verify that the incoming HTTP request originated from Azure DevOps and that the payload was not tampered with in transit?