Invoking Azure Runbook SharePoint Operations Using Webhooks - Part One

Introduction
 
In this series of articles, you will learn how to create Azure webhook for an existing Azure runbook, and invoke the runbook through the webhook created.
 
This article is part one of the series, and explains about invoking the PowerShell operations built on Azure runbook by external applications. In this article, you will see the introduction and learn the basics of the webhook implementation. 
 
Azure runbook help us in accomplishing the tasks in an automated way, from the Azure portal. Azure runbooks are available on Azure portal and can be triggered/invoked from the external application. To trigger the runbook from the external applications, the runbook should somehow be exposed to the services. The runbooks can be exposed to the external applications using webhooks.
 
Webhook helps users to start executing the Azure runbook through an HTTP request from external applications.
 
Let us see how this can be implemented using a real world scenario. For basic understanding, let's take an example of creating a SharePoint list on SharePoint online portal, using Azure runbook and Azure webhook. The below snapshot shows the pictorial view of the implementation.
 
Note
  • Azure runbook has the core logic for creating a SharePoint list on the portal, using the input parameters from end users.
  • Azure webhook exposes the runbook to the external application through HTTP protocol.
Flow 
  1. User writes the code in the external application, like PowerShell, to invoke the runbook using the URL exposed by webhook. User will supply the input parameters and execution time through HTTP request.
  2. PowerShell triggers the call to webhook.
  3. The webhook invokes the Azure runbook which has core SharePoint list creation module.
  4. The output is logged in to jobs.
  5. Users can view the jobs at any point of time.  
The above flow is a very basic level of automation. In such ways, complex logics can be implemented, exposed, and can be executed through external applications with HTTP protocol requests.
 
I assume the automation account creation, importing SharePoint modules, adding credentials, adding runbook and implementing the logic has been completed prior to starting this article. If you are not familiar with automation account setup and runbook creation, it can be learned from the below articles.
In my next article, you will learn how to create webhook for the Azure runbook.