Calling the Power BI REST API in Power Automate enables seamless automation and integration of Power BI capabilities within your workflows. This setup allows you to interact with Power BI Semantic model directly from Power Automate.

Steps to Set Up Power BI REST API in Power Automate

1. Register Azure App for Power BI

Register an Power BI app: Onboarding Embed Tool

Choose whether you want to Embed it for your customer, or for your organization. I will go with my company.

2. Azure Portal & App´s permissions

Add API permissions to the newly created app from step #1 in the Azure portal: Home - Microsoft Azure

In API permissions, add Application permissionsTenant.Read.All.

Then, grant admin consent.

3. Generate Client secret

To integrate Power Automate with your Power BI app, you need to generate a new client secret. This secret will be required later for authentication.

  1. Go to Azure Portal and navigate to your registered app.

  2. Under Certificates & Secrets, click New Client Secret.

  3. Set an expiration period and click Add.

  4. Copy the Secret Value immediately, as you won’t be able to view it again and store it.

4. Publish Power BI dataset into Workspace

To interact with the Power BI REST API, you need a Power BI semantic model that is published to the Power BI Service.

  1. Create a new Power BI semantic model in Power BI Desktop.

  2. Publish the model to your Power BI Service workspace.

  3. Ensure the workspace is correctly configured for API access.

For this tutorial, I created a new semantic model and published it to my Power BI REST API workspace.

Now that the model is in place, we can move on to making API calls!

5. Create Power Automate Flow

To interact with Power BI using DAX queries, we’ll set up a Manually Triggered Flow in Power Automate.

  1. Open Power Automate and create a Manually Triggered Flow.

  2. Add a variable to store your DAX query.

  3. Prepare your DAX query:

    • In Power BI Desktop, create a new table.

    • Open the Performance Analyzer and copy the DAX query generated behind the table.

Now, with the DAX query ready, we can use it to fetch data from the Power BI REST API in the next steps!

6. REST API call in Power Automate

Now that we have our DAX query ready, let's set up the API request in Power Automate to execute it against a Power BI dataset.

Dataset ID – Retrieve your Dataset ID from the Power BI Service and insert it into the API URL: https://api.powerbi.com/v1.0/myorg/datasets/{DatasetID}/executeQueries

DAX Query – Use the DAX variable initialized in step #5. This query will be sent as part of the request body.

  1. Directory (Tenant) ID – Copy the Directory (tenant) ID from your Power BI App registration in Azure.

  2. Application (Client) ID – Retrieve the Client ID from your Azure App registration.

  3. Client Secret – Use the Client Secret generated in step #3 for authentication.

Finalizing the request:

  • Ensure you select POST as the HTTP method.

  • Set the authentication type to Azure Active Directory OAuth.

  • Pass the Dataset ID, DAX query, and authentication details in the request.

Once configured, this step will allow Power Automate to execute a DAX query via the Power BI REST API and retrieve results.

7. Set up in Power BI service

Before calling the Power BI REST API, you need to ensure that Power BI Service is properly configured to allow API access. Follow these steps:

1. Enable Service Principal in Power BI Admin Portal
  • Navigate to Admin PortalTenant Settings.

  • Look for Developer Settings and enable Allow service principals to use Power BI APIs.

  • Toggle the setting to Enabled and apply it to the entire organization or specific security groups.

2. Grant Access to the Workspace
  • Go to the Power BI workspace where your dataset is stored.

  • Click on Manage Access and add the Service Principal (the application registered in Azure AD).

  • Assign Admin or Member permissions to the Service Principal for full API access.

3. Verify Access and Permissions
  • Ensure that the Power BI REST API workspace is properly configured.

  • Double-check that the Service Principal has the necessary roles to execute API calls.

Once these settings are in place, Power Automate can securely interact with Power BI through the REST API, allowing for automated data retrieval and updates!

Enjoy calling Power BI REST API in Power Automate!

Keep reading

No posts found