Showing the latest Visual Studio Team Services Build run status on GitHub

If you have your code on GitHub and configured a build definition on Visual Studio Team Services for continuous integration you have probably wondered if it is possible to show the latest build status on your GitHub readme file.

And the good news is that YES, it's possible and very straight forward to configure, here's how.

Edit your Visual Studio Team Services build definition and go into the General tab. In there click the Badge enabled tickbox and then click the Save button to save the build definition: 

Once you have saved it, you will see a Show url... link that gives you the link to the latest build status badge:

Now, on the GitHub side (or any other place for that matter), you can use that as an image source. For example, in my Node.js + Azure DocumentDB sample I edited the file and added a normal html img tag with with the link from above. So now when the latest Visual Studio Team Services build is successful it looks like this:

And if it fails it looks like this:

The functionality is pretty simple at the moment, but useful if you just want to see the latest build status.