SPN + Azure Runbook + Webhook = Power BI Refresh (pt. 2)

In my previous post I described how to create an “Azure Based Black Box” able to run Power BI datasets refresh through API calls secured by SPN using PowerShell scripts in Azure Automation Runbook.

At this step is not possible to run this process without running the Runbook and in that case we should setup permission to each application in order to reach the specific Runbook and to run it.

Our aims are to lower the implementation and maintenance effort, to standardize the way we want this to be run giving an unique access point reachable to all the applications able to perform a post call.

Luckly Runbooks support webhooks.

What Wikipedia says about webhooks:

Webhooks are “user-defined HTTP callbacks”. They are usually triggered by some event, such as pushing code to a repository or a comment being posted to a blog. When that event occurs, the source site makes an HTTP request to the URL configured for the webhook. Users can configure them to cause events on one site to invoke behavior on another. Common uses are to trigger builds with continuous integration systems or to notify bug tracking systems. Because webhooks use HTTP, they can be integrated into web services without adding new infrastructure.

Basically we will create a webhook assigned to our Runbook and this will be called by applications with a POST call.

Specifying its expiration time, just one line of PowerShell is needed to create a webhook:

NB: as the warning says make sure to copy and save the URL that will be presented in this output window as you won’t be able to get it back from anywhere in the future.

Now you can call the Webhook from any application. In the following screenshot I’m performing a post call to that webhook using Postman, but you could use PowerShell or any kind of application you want.

The POST request will give you the Azure Automation Runbook Job Id assigned to your request.

Opening the Power BI portal I can verify refresh completed successfully.




Container of my adventures wrangling data

Recommended from Medium

Syllabifying toki pona with a Regular Expression

AWS Serverless and Microservices — Part 3

Zuri X I4G Internship: My Goals

15 Useful Snippets for your Daily life Python Problems

python snippets

Discord ConnectX

Create AWS EC2 Instance using AWS CLI

LinkShare (Many problems one solution)

Trends in Cloud Technology to expect in 2021

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Perico Riccardo

Perico Riccardo

BI & Power BI Engineer since 2010 — Data and me in a complicated relationship — Hard Rock and Heavy Metal addicted

More from Medium

Create a Custom Connector for Consumption Logic Apps using the Azure Portal

GraphCMS Webhook API to Snowflake

External tools in Power BI Desktop

5 Kusto Queries for Azure Log Analytics with AAS/Gen2