Updating Slack channels with Azure Automation


I have been playing a bit with Azure Automation again, and my company and also several customers run Slack, ever heard of it? It is gaining grounds in IT as a collaboration tool and email-killer.

With slack you can connect with a web browser or an app that is available for almost all platforms today! this making it really easy to get everyone onboard using it in your projects or teams to keep up to date.

Once you have got a token for your slack account you can update with a new message, in this case PowerShell:

So how can this be utilized with automation?! Assume that you have some deployment or automated build process that either runs in azure or on premise and your devs want to get information if it was successful or if it failed.. So in that deployment runbook in Azure Automation you can call the Update-Slack runbook with parameters to give the user information on what have happened if it failed or if it was successful.

Screen Shot 2015-09-08 at 15.17.45

In the Slack window it shows the user sending and that it is by they Slackbot

Screen Shot 2015-09-08 at 16.00.14

Another way is if you have a system that can send a web request, then you can use the new Azure Automation webhooks to kick of the runbook to update Slack. My runbook example contains parameters for both ways so I do not have to create two different runbooks depending on what way the req comes to start the Update-Slack runbook.

So how do I handle this in the runbook? In the following runbook I have the user and the token saved as variables and three input variables depending on where the request comes from.

As you can see there are numerous ways of updating and of course it can be done for facebook or twitter or some other social platform if that’s prefered 🙂