top of page

Invoking Azure Runbook SharePoint Operations Using Webhooks - Part Three


In this article, you will learn how to invoke Azure Runbook's Webhook, using external application like PowerShell.

This article is part three of the series that explains about invoking the SharePoint Online PowerShell operations built on Azure (runbook) through Azure Webhooks, using external applications.

In the previous articles, we have seen the basic understanding of each components. The flow of the operations was explained in detail. Also, we have seen about creating Webhook on Azure runbooks. The following links are the references to the previous articles.

Step 1 - Open Windows PowerShell ISE as administrator.

Step 2 - Then, provide necessary inputs for the Webhook created. Webhook receives the parameters and triggers the operations saved on the corresponding runbook.

The required parameters for the operation are -

  • Webhook URL - The URL is obtained when the Webhook is created. Please refer to the previous articles if you are not clear about this URL.

  • Headers

  • Body - The input content for runbook. In this case, credentials name stored, SharePoint site URL, list name to be created on the site, list template name used to created the site are required. Then, convert this input to JSON format before sending.

Invoke the method by using the POST request with above inputs ( Webhook URL, headers and the body content). Then, receive the response and make necessary actions.

The following code snippet shows the steps.

  1. $uri = ""

  2. $headers = @{"From"="";"Date"="09/17/2016 12:55:00"}  

  3. $vms  = @(              @{ CredentialsName="nakkeeranspo";SiteUrl="";ListName="TestList2";ListTemplate="Generic"}          

  4. )  

  5. $body = ConvertTo-Json -InputObject $vms   

  6. $response = Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -Body $body  

Step 3 - Execute the code by pressing F5.

Step 4 - Once execution completes, go to the Azure Portal -> Runbooks -> Click on the necessary runbook -> Then, click on the jobs.

Step 5 - Click on input under the corresponding job to see the values passed.

Step 6 - Click on output of corresponding job to see results.

Step 7 - Now, if you want to check the list created, go to SharePoint portal and check the lists.


Thus, you have learned how to trigger the Azure runbook operations through Webhooks, using external application (PowerShell).

From the articles series, you have learned how to create the Webhooks for SharePoint operations created on Azure runbook. Also, we have seen triggering the Webhooks using PowerShell. 



bottom of page