Power BITeams

How to set up a Power BI report automation system for Teams

Joel Monteiro
June 14, 2023

Report automation systems save organizations time, money, and free employees from the recurring task of sending colleagues and clients data from their Business Intelligence system of choice. They are also free from human error and ensure that information is always delivered on time.

Another major advantage of a report automation system lies in its extensive information-sharing capabilities. Given the sensitivity of the data handled, most Business Intelligence tools’ sharing capabilities are merely internal by default, with external features often locked behind a premium tier plan that must be subscribed to by those who share and those who receive the information must subscribe to.

In this tutorial, we will teach you how to set up a Power BI automation system using PowerBI Robots that sends screenshots of your organization’s reports to a team on Microsoft Teams where you can have internal and external (guest) users.

What you’ll need:

  • Access to your organization’s PowerBI Robots
  • Access to your organization’s Azure Portal

PowerBI Robots can send high-definition images or PDFs of Power BI reports to a multitude of endpoints, namely email, a shared folder, a SharePoint directory, or a Webhook, which opens the possibility to deliver reports anywhere. Taking advantage of the Webhook feature, we are going to create a Logic App that receives the images generated by PowerBI Robots and sends them to a team on Microsoft Teams.

Setting up your Azure Logic App

Access your organization’s Azure portal, click “Create a resource” and search for Logic App. Choose your app components in the following order (we’ll go over the details later):

  1. HTTP trigger
  2. Function: Initialize variable DateTime
  3. Function: Initialize variable Body1
  4. For each loop

How to set up a Power BI report automation system for Teams 1

Start by clicking the HTTP trigger and copy the HTTP POST URL to a text file. We will later use is as the Webhook when configuring our Power BI reports playlist.

Next, open your PowerBI Robots web client, and go to the Help center. Go to the “Delivery to” tab, click Azure and copy the JSON object literal to your clipboard. Keep the PowerBI Robots tab open as we’ll need to return to it later.

How to set up a Power BI report automation system for Teams 2

Return to the HTTP trigger on the Azure Portal and paste the JSON code under “Request Body JSON Schema”.

How to set up a Power BI report automation system for Teams 8

Next, click the second step in your Logic App, “Initialize variable DateTime”. Name it varDateTime, choose string as your type and select formatDateTime under your value. This variable will be used in the message we’ll be sending to Teams.

How to set up a Power BI report automation system for Teams 3

Then, click the third step, “Initialize Variable Body”. Name it varHTMLBody and select String as your type. This variable will store the text we’ll be sending to Teams.

How to set up a Power BI report automation system for Teams 4

Finally, click the last step in our Logic App, the For Each loop. This will loop through each image in your report playlist, send it to an Azure blob storage and use that blob storage’s URL to send a message to our team. To start, select reports as the output format and add the following actions:

  1. Create blob (V2)
  2. Create file
  3. Set variable
  4. Post message in a chat or channel

How to set up a Power BI report automation system for Teams 5

First, let’s click “Create Blob (V2)”. We will choose “Use connection settings” under “Storage account name or blob endpoint”, create a folder for your reports under “Folder path” and we are going to name our blob followed by the workflow function, as displayed below.

How to set up a Power BI report automation system for Teams 12

Then, click “Create a File”. Settings here will be the same as in the previous step, as shown below:

How to set up a Power BI report automation system for Teams 13

Click the 3rd action, “Set variable”. Under name, select the varHTMLBody we set earlier, and under Value write the message body as you see fit. The Logic App can interpret HTML tags and use dynamic elements, so, let’s illustrate this by using 3 paragraph elements, all of which contain dynamic content:

  • Name – to display our report’s name.
  • Date – to display the date according to the variable we set earlier.
  • Path – to display our reports. The image source will be the path to our blob storage followed by a dynamic element Path to fetch each image.

How to set up a Power BI report automation system for Teams 6.1

You can use any HTML elements you want to display your message on Microsoft Teams.

Next, we need to pick the team to whom our reports will be sent to. Click the final action (Post a message in a chat or channel) and fill in the sender (Post as), select where you want to post the report (Channel or Group chat), the Team of your choice, and the channel inside that team. Remember the HTML we just configured in the previous step? That will be our message here.

How to set up a Power BI report automation system for Teams 6.2

Setting up PowerBI Robots’ Online agent

The first thing we need to do is log into PowerBI Robots and click Create to start a new playlist. In the General tab, name your playlist, select Image as your output format, and Webhook under Deliver to. In this screen, you should also set the recurrence of your choice, i.e., the frequency with which your report playlist will be delivered to your team.

How to set up a Power BI report automation system for Teams 9

On the next tab, Recipients, grab the HTML POST URL you copied to a text file and paste it under Webhook URL.

How to set up a Power BI report automation system for Teams 7

Proceed to the next tab (Visuals) and click Add Power BI visual to connect your Power BI account to PowerBI Robots. In the modal, select the reports you wish to add to your playlist. Finish by clicking Update.

Setting up PowerBI Robots’ Desktop agent

As in every PowerBI Robots tutorial, the last step is always to make sure the app is running and to do that, you must download the PowerBI Robots Desktop Agent from the web agent’s Backoffice (or click here) and install it. After you do so, open the PowerBI Robots Desktop Agent.

How to set up a Power BI report automation system for Teams 10

In the first tab, you must paste your unique PowerBI Robots ID, found in the top right corner of the web agent, and click Synchronize. Next, click on step 2, “Configure Power BI access”. This will redirect you to the second tab where you must connect your Power BI account to the PowerBI Robots agent. After you do so, go to the “Service” tab and click start. A green sign indicates the agent is running, something you can also verify in the web agent’s lower left corner.

And that’s it. At the recurrence of your choice, PowerBI Robots will deliver a screenshot of each report in your playlist to the team of your choice and be viewed by any users on that team, even if they are only guests in your organization.

How to set up a Power BI report automation system for Teams 11
Banner animado PowerBI Portal
Next article

CyberComm is here to help prevent cyber attacks

DevScope joined forces with Microsoft Portugal and the Portuguese Center for Cybersecurity to launch CyberComm for Teams.

Joel Monteiro
June 7, 2023