Getting Azure Web App deployment status notifications in Slack

Introduction

Azure Web Apps have a great feature: continuous deployment from different kinds of repositories: Visual Studio Online, OneDrive, a local Git repo, GitHub, Bitbucket, Dropbox or an external repo. You also have built-in alert notifications, but there’s no built-in notifications for deployments, and that’s where Kudu web hooks come to the rescue.

But first, what is Kudu?

Project Kudu is an open source project hosted in GitHub that is the engine behind Git/Mercurial deployments, WebJobs, and various other features in Azure Web Apps. And, it can also run outside of Azure.

What are Web Hooks?

A Web Hook is an HTTP callback: an HTTP POST that occurs when something happens; a simple event-notification via HTTP POST. Web Hooks are a way to receive valuable information when it happens, rather than continually polling for that data and receiving nothing valuable most of the time.

How do we integrate?

At Nubimetrics, like many other startups, we use Slack as our team communications platform. Slack offers integration with other apps and services like GitHub, Bitbucket, Trello, Asana, JIRA, Google+ Hangouts, Google Drive, Dropbox and Visual Studio Online, just to name a few (if you are interested in all integration options visit https://slack.com/integrations).

As you can see, we have no built-in integration with Kudu, but web hooks come to the rescue again! Slack supports incoming web hooks as a way for other apps to to post messages into Slack.

And, to make things easier, there’s an already built app hosted in GitHub, that is written in Node.js and runs on Azure.

All we need to do is:

  1. Go to our Slack team configuration and set up an incoming webhook integration.
  2. Deploy the app from the deploy button.
  3. Configure an environment variable named slackhookuri with the value of the URI from Step 1.
  4. Add the URI to your Azure web app Kudu portal web hooks, you reach it via https://{your azure web app}.scm.azurewebsites.net/WebHooks
  5. And that’s it!!

Conclusion

Web hooks provide us an easy way of integrating web applications. Using simple web requests with a JSON payload we can integrate almost anything!

Happy coding!

@gjbellmann

Advertisements

One thought on “Getting Azure Web App deployment status notifications in Slack

  1. Danfer Habed López

    Hi, nice post, just to be aware that the URI to be entered at the webhook value at site’s scm configuration should be the URI of the Kudu web app published from Git. Cheers.

    Like

    Reply

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s