Azure – “Executing Runbooks with Power Platform and Webhooks”

The Question

In a recent Workshop I wanted to explain how you could use webhooks in clever ways to kick off specific tasks in Azure Automation. Specifically I wanted to create a Power App where I could just click a button and all my Az Modules in my Azure Automation Account gets updated.

You can also find a copy of this module on Github – microsoft/AzureAutomation-Account-Modules-Update: An Azure Automation runbook that updates Azure modules imported into an Azure Automation account with module versions available on the PowerShell Gallery. (github.com)

The Investigation

  1. Create a Webhook

If you have never created a webhook before it is super easy,

Click “Webhooks” and “Add Webhook”
Configure “Create new webhook” and “Parameters and run settings”
Fill in all the details and COPY the URL

2. Test the Webhook with PowerShell

#Update Module
$uri = "insert URI here"
$response = Invoke-WebRequest -Method Post -Uri $uri
Great it works! Now onto the next sections

3. Create Power Automate Flow

In Power Automate Create a Flow like the below.

4. Create Power App

Create a Power App to you own liking and then click on Action to Select Power Automate

Fill in your URI as you copied it from the Webhook Creation Step and click “Update”

The Solution

Now you can run the Runbook from any device that can access Power Apps even your mobile device! The fun doesn’t stop there as you can now create any type of app for example Server Restarts, Server Up or Downscale, Specific Runbooks and pretty much anything that can be scripted.

More:

If you would like to learn cool things like this reach out to you Microsoft Account Manager and ask for our list of titles related to Azure Automation. We did some of this in “WorkshopPLUS – Azure Cloud and Datacenter Management with Azure Automation”

Authors