Microsoft Power Bi is a powerful tool to embed the analytics dashboards, reports and Tiles into your web application. Data security is one of the important aspects. Power BI embedded services allow you to securely embed Power BI dashboards using embedded tokens. Additionally, you can also apply row level security to allow your web application users to see specific data sets.
We are using a Master account to generate the Power BI embedded token. You need to purchase a subscription of a Power BI Pro account. Power Bi Signup
We are demonstrating the integration of the reports and dashboards using Power BI REST APIs. To access the Power BI Rest APIs, it is required to register an application with Azure AD. Once application is registered, you can get access to the Power BI Rest APIs.
Note: To register an application in Azure AD, it is important that you have Azure Active directory tenant and organization user.
You can create a Power BI application using Power BI App registration Tool. This is the easiest way of creating an App as this has less form fields to fill. You can also create an App using Azure AD portal.
1. Sign in at Power BI App registration Tool.
2. Register an application
· Fill Application name
· Select Application Type
You have two options to choose Application type – Native (For Apps IOS, Android) and Server-side web application (for web apps/web APIs)
· Fill Home Page URL
· Fill Redirect URL
Both URLs can belong to your web application you have created.
3. You need to choose the required REST APIs and access permissions for your web application. In the below case, we have chosen all the APIs and permissions
4. After successful registration you will get the Application Id and Application secret.
5. For server-side web application integration type, you need to grant consent for the master account to avoid being prompted for consent by Azure AD. You need to provide the consent permissions to the master account through Azure AD portal.
· Go to Azure AD portal
· Search for App Registration in the search box and select the application you have created in
· Select your Application from the list of applications retrieved in App registration window.
· Select the API permissions from the left panel. You can click on Add permissions in case you need to give additional permissions to your application. To grant admin consent, click on “Grant admin consent for ” and give the consent.
Step 3: Get Azure AD Access token for Power BI application using REST APIs
You need to get the Azure AD access Token before you make calls to Power BI rest APIs. This access token is required to authenticate the Master account. In this approach, we are using Master Account Authentication type. There are different ways to fetch access tokens from Azure AD. We would fetch the grant type “password” in this case.