Azure DevOps Web Hooks Demo with Polaris

It’s possible!

As a happy ITPro I love to make use of all features available in any tools I use. Azure DevOps (Former VSTS) has Service Hooks which wasn’t picked by any automation guys at my work place. So, I spent few hours and explained what we can achieve in Azure using Web Hooks. Yes, many liked it. In this blog post let me show you the simple way to create a POST route and do some action when any event in triggered from Azure DevOps. For demo purpose I installed NGROK using NPM in my machine to expose my localhost to internet – Indeed, it’s not advisable in production environment.

Our goal is to clone a repo when a work item with a type a task is created and tag reads as “Clone iAzureDevOps” – Indeed, it’s not a great exercise, but for me being an ITPro it’s a good start. Just follow the simple steps and share your feedback!

Checkout this video!

  1. Set up your web hook (Work item created and set tag field as “Clone iAzureDevOps”)
  2. Create your web server using Polaris, in my case, route is like below
Import-Module Polaris -Verbose

New-PolarisPostRoute -Path "/" -Scriptblock {
    $Test = Test-Path C:\temp\iAzureDevOps
    if ($Test) {
        Remove-Item C:\temp\iAzureDevOps -Recurse -Verbose -Force
        git clone "https://about-powershell@dev.azure.com/about-powershell/iAzureDevOps/_git/iAzureDevOps" C:\temp\iAzureDevOps
    else {
        git clone "https://about-powershell@dev.azure.com/about-powershell/iAzureDevOps/_git/iAzureDevOps" C:\temp\iAzureDevOps

Start-Polaris -Port 8080

Start the web server and enjoy it!

Enjoy PowerShell! For more information about #Polaris follow me on twitter @ChendrayanV 

Leave a Reply

Your email address will not be published. Required fields are marked *