December 1st: Azure Automation: Triggering a webhook from a SharePoint workflow using Out-of-the-box Activities

Welcome to this year Coretech December Calendar!

Today is the 1st of december and we have a great little christmas treat for you!

This is the first post in a series of posts, published every day in December.

Today’s subject is Triggering Webhooks from SharePoint!

One of the great new features in Azure Automation is Webhooks!

Webhooks is everywhere! More and more cloud services support them.

Basically it is a simple HTTP Post sent to a web service that starts the runbooks.

We can then send a bunch of data with the post and have the runbook receive these dato.

For how to create webhooks look: See the official documentation here

For how to receive and process the input, take a look at my blog post here

This article will discuss how you can easily trigger one of these webhooks directly from a SharePoint workflow, either from on-prem or SharePoint Online!

Here’s how it goes:

  • Logon to SharePoint
  • Find the list you want to use for the workflow
  • Edit the list in SharePoint Designer

image

  • Add a workflow to the list using the “List Workflow” button (this button only shows if the workflow part of the screen is focused)

image

  • Choose Sharepoint 2013 or 2010 workflow (So far I have only tested with Sharepoint 2013, but will update soon)
  • Name the workflow whatever you like
  • Now you are ready to design the first stage in the workflow:

image

  • What we need is a Dictionary to populate the runbook input with values from the list item, a dictionary for headers and a call to the webhook.
  • Add a “Build Dictionary “
  • Add Any of the value from the List item (or other sharepoint value or fixed values) to the dictionary. These will be sent as inputs to the runbook.

image

  • Add the “Call HTTP Service” activity

image

  • Setup the activity

image

  • Optionally: Set a status or similar on the sharepoint item (such as “Requested”)
  • In the end your workflow will look like this

image

  • Now is the time to set the workflow to an action.
  • Go back to the workflow settings at set one of “start workflow automatically” settings

image

  • or create a custom action in the context menu to execute the script such as this example of a “remove license” action

image

Please don’t hesitate to post your comments or questions! More about this subject soon, if the interest is there! Smile

Merry xmas!

By | 2015-12-01T12:00:00+00:00 December 1st, 2015|Automation, Azure|7 Comments

About the Author:

Jakob Gottlieb Svendsen

Twitter: @JakobGSvendsen

Jakob Gottlieb Svendsen is a Microsoft Cloud and Data Center Management MVP (http://mvp.microsoft.com/en-us/default.aspx), Working as Global Lead Developer, Senior Consultant and Trainer at CTGlobal, where he is one of the driving forces in keeping CTGlobal a System Center Gold Partner and member of the System Center Alliance.

Since he started at Coretech in 2007, he has focused on Scripting and Development, primarily developing tools, extensions and scripts for the System Center Suite. His main area is Automation (including OMS/Azure Automation, Service Management Automation, PowerShell and Orchestrator). Another area is Windows Azure Pack / Azure Stack, where he does implementation, development, workshops and presentations. He is a world-wide renowned voice in the Automation field.

He is passionately devoted to the community, to which he contributes by being a moderator at TechNet and sharing his knowledge at http://blog.ctglobalservices.com/jgs

  • Co-founder: PowerShell User Group Denmark
  • Speaker at MMS 2016, Minneapolis (www.mmsmoa.com)
  • SCU Europe 2014, 2015, 2016 (www.systemcenteruniverse.ch)
  • Microsoft TechEd North America 2014, Houston
  • NIC 2012,2013,2014,2015, Oslo (www.nic.com)
  • Microsoft CampusDays 2011, 2013, Copenhagen
  • Microsoft TechDays 2015, Sweden (www.techdays.se)
  • Microsoft Partner Event: New in SC2012 SP1
  • User group meetings (PSUG.DK , SCUG.DK/BE/NO, AZMUG + more)
  • Microsoft Certified Trainer.
  • Microsoft Scripting Guys Forum Moderator

Main working areas:

  • Automation (Azure Automation, SMA, SCO)
  • Windows Azure Pack / Azure Stack
  • System CenterVisual Studio Team Services / Team Foundation Server
  • Development:C#.Net, VB.NET, VBScript, PowerShell, Service Manager, OpsMgr, ConfigMgr
  • Orchestrator
  • Windows Azure Pack / Azure Stack

Training:

  • Azure Automation
  • Service Management Automation
  • System Center Orchestrator
  • PowerShell, VBScript, C#.Net, VB.Net
  • Windows Azure Pack / Azure Stack Development Workshops

7 Comments

  1. Divyadeep December 4, 2015 at 21:21 - Reply

    If the runbook requires parameters, have you tried posting them in JSON?
    Example VM name to a start vm runbook or
    vmname, servicename, osname and imagename to a create vm runbook

  2. […] OMS black belt Jakob also have great ideas about using SharePoint Online that I recommend, read it here […]

  3. remy June 30, 2016 at 10:55 - Reply

    Hi Jakob,

    Your solution works perfect, thanks. I was just wondering if you could help me out. I would like to assign a button to the workflow/webhook, not entering a new row as in your tutorial. Is this possible? My runbook does not need any parameters. I really want to fire off the runbook with a button. Would be great for any assistense, thanks!

  4. Nematallah DoustiNouri July 31, 2017 at 7:29 - Reply

    Hi Jacob,
    Thanks for sharing this useful article .
    Is web hook available for SharePoint 2013 on-premises?

Leave A Comment