Visual Studio Team Services – Creating a build pipeline (Part 6)
Published Feb 12 2019 02:25 PM 438 Views
Iron Contributor
First published on MSDN on Nov 09, 2016

Authored by Jeffrey Chilberto

In part 1 a basic Azure Web App website was built and deployed using VSTS Build and Part 2 illustrated how additional files could be included when building a web project. Part 3 demonstrated how Gulp could be added to the VSTS Build pipeline.  In part 4 Load Testing was added to the build pipeline and part 5 added slots to help smooth the build process and limit downtime.  This post will look into using service hooks in VSTS, and as an example, will integrate with an existing Slack team in order to post messages when a build fails.

Service Hooks

VSTS provides service hooks for reporting events to external systems.  The events and supported actions vary depending on the external system.  For example, when integrating with Trello , a popular on-line collaboration tool, the following events and actions are supported:



Build completedCreate a card Code pushedCreate a list Pull request created Pull request updated Team room message posted Work item commented on Work item created Work item updated

There are many services built in and additional services that can be targeted by service hooks are available in the Visual Studio Marketplace .  Service Hooks are well documented and each service shows the sequence of steps required to configure them:



As an illustration of service hooks, let's add a slack notification when a

The first step is to configure slack for integration with VSTS.   Within the slack team, select the Apps & integration option:

Search and find the Visual Studio Team Services application and Install:

In the option to Post to Channel, an existing channel or the ability to create a channel can be selected.

After the application is configured, slack provides control for removing or disabling the integration as well as setup instructions.

Note: in the setup instructions and in the Integration Settings is the Webhook URL which is needed in the VSTS setup:

Setting up a Service Hook in Visual Studio

Slack and both provide setup instructions so in order to make this post a bit more interesting, let's setup a service hook only for when a build ends.  In VSTS, select the Service Hooks menu from within the build project:

After selecting Slack, you can then specify the event and filters.  In this example, only Failed builds will generate a message:

The final step in the wizard requires the Slack webhook address and a convenient way to test the integration:


Service Hooks is a great feature for integrating the activity of VSTS into external applications.  There are many out of the box services available as well as the ability to subscribe to VSTS to receive notifications about build events .  Service Hooks and other features allow teams to handle events as they happen and not just when reported or stumbled upon.  For example, with the Slack application running, alerts in the Action Center are immediately brought to the attention of the devops as illustrated below:

Version history
Last update:
‎Feb 12 2019 02:25 PM
Updated by: