Skip to content

Instantly share code, notes, and snippets.

@cscott530
Last active March 3, 2020 00:05
Show Gist options
  • Save cscott530/d589c63dfe953f142ffc76f53901d3a3 to your computer and use it in GitHub Desktop.
Save cscott530/d589c63dfe953f142ffc76f53901d3a3 to your computer and use it in GitHub Desktop.
Posting notifications to slack when an Azure deployment completes.

NOTE: You will need to be a Slack admin, and have access to create web sites, etc., in the target Azure account.

  • Go to slack, creating a new web hook.
    • Note the webhook URL (e.g. https://hooks.slack.com/services/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)
    • Set it to post the channel you'd like.
  • Go here, click deploy.
    • This adds a web-hook listening site to Azure
  • Log in to Azure and find the above site that just deployed
    • Open the Application Settings, find App Settings
    • Add slackhookuri, set its value to the above web hook URL (hooks.slack.com...)
  • Log in to your Azure site's Kudu site
    • https://{mysite}.scm.azurewebsites.net/WebHooks (note, this isn't the one you just did, but the one you want to watch for deployments, e.g. pomodo-alpha.scm.azurewebsites.net).
    • Add a new post deployment web hook, pointing to the site you just deployed to azure, (such as https://kudupostdeploymentslackhook5437.azurewebsites.net/)

Whenever a deployment succeeds, you will get a message in Slack with the message of the commit that triggered it.

Unfortunately, it looks like we are unable to reuse the same post deployment hook application. So this will need to be redone for each instance of your application (sorry LEM).

@nhruska
Copy link

nhruska commented Jul 12, 2019

Hi Chris,

Can you remove this gist please? Slack said the webhook URL is unique, so they removed our integration and disabled the URL. no real issue, but just want to clean this public gist out. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment