Visual Studio 2017 Update 2 to support Microsoft Teams with On-Premise TFS

Well it appears my TFS work-around will no longer be needed. Buck Hodges has posted that TFS 2017 update 2 will support TFS integration with Microsoft Teams when it is released

Hopefully this may also fix the notification issue that I have seen when using it.

Adding Some Colour to Microsoft Teams Notifications

Now that the basic link is in place between On-Premise TFS and Microsoft Teams it’s time to tinker.

The first thing that I wanted to do was add some visual feedback to the notifications, specifically notifications for builds.

This can be achieved by adding the “themeColor” property to our output (the Card Reference documentation suggests not to use this for status, but it works well enough )

I want two new statuses, failed build should be red whilst partial failures should be orange.

To do this I needed to update the output section for each endpoint as below:

Build Failure

var output = {};

output["title"] = "Build Failed";
output["text"] = detail;
output["themeColor"] = "ff0000";

Partial Build Failure

var output = {}; 

output["title"] = "Build Partial Failure";
output["text"] = detail;
output["themeColor"] = "ff9900";

This results in a nice visible orange and red bar at the top of each post:



TFS/Teams Integration Performance & Issues

Since my first post the node.js bridge between On-Premise TFS and Microsoft Teams has been up and running with no issues and Slack has now been completely removed from our business.

The 14 day status for one of our projects can be seen below:


This is much better than when integrating with Slack which always showed a number of failures.

Unfortunately it appears that there is an issue on the Microsoft Teams side. Updates from connectors do not appear to trigger notifications on followed channels, posting manually to the channel does trigger them.

I was able to replicate this using the curl example from Microsoft’s “Getting started with Connectors for Microsoft Teams” page so it does appear to be a Teams issue and have raised a ticket with Microsoft Support.

For the moment if you want to know if your builds have failed you need to keep an eye on the client!

Bridging On-Premise TFS and Microsoft Teams using Web Hooks and Node.js

At the beginning of this year Microsoft release their Slack competitor Microsoft Teams. After having recently migrated Exchange,Skype and SharePoint to Office 365 this seemed a natural next step for us.

My main use for Slack was as a central point for notifications from other applications such as StatusCake and Team Foundation Server. Unfortunately whilst the web hooks were compatible with Microsoft’s online offering of Visual Studio Team Services the output from an on-premise Team Foundation Server (in this case TFS 2015 Update 2) was different. This killed the usefulness of Teams for us completely.

Fast forward to now and I decided to revisit this issue and see if any progress had been made. Unfortunately Microsoft still does not have official support for this however I came across this post which gave me some hope I might be able to work around this.

Taking this code and making some modifications I was able to create a node.js based Windows service that translates the JSON from TFS and forwards it to Microsoft Teams in a format it understands.

Here’s how I did it.

Continue reading