Azure Function to enable Microsoft Graph API webhook subscriptions to Azure Automation webhooks

Azure Functions is a great new, cheap and easy way to publish simple web services.
Functions can be written in multiple languages such as C#, PowerShell or even Batch!
You can read more about them here:
https://azure.microsoft.com/en-us/services/functions/
This Azure Function is based on PowerShell and I have used it in multiple session on conferences such as MMS 2016 (was in a C# version though) and System Center Universe Europe 2016
About the function:
When using subscriptions in Microsoft Graph API, you have to Validate your webhook by returning a verification code which Graph API sends to the webhook.
Unfortunately Azure automation webhooks does not include this functionality, therefore I created this Azure Function to help validating the webhook and enable graph api webhooks for runbooks.
To create the subcscription I am using a PowerShell module which I created and published myself. You can get it here:
https://www.powershellgallery.com/packages/MicrosoftGraphAPI
It is open source, therefore you can contribute to the module at my github repo here:
https://github.com/JakobGSvendsen/MicrosoftGraphAPI
NB! Please bear in mind that PowerShell in Azure Functions is in “experimental” status, which means this shouldn’t be used in production just yet.
Here is the code for the function it self:

The URI that you need to provide to graphAPI will be similar to this:
https://graphhelper.azurewebsites.net/api/PSwebhooks?code=m6tk6w9fxhx6k5986m9dfdsfdsf&token=sdsdsdsdsdsaer3434
The code is part of the GUI in azure function editor

The token is the token from your Azure Automation webhook URI
https://s2events.azure-automation.net/webhooks?token=%2fq3jGVPzwLCpx19RcBU7eUGqO1tjFJq6hcGiT4d9D%2fk%3d

By | 2016-08-24T16:00:48+00:00 August 24th, 2016|Azure|0 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

Leave A Comment