How to create Power BI embed token to host reports in Web Application
In area of data visualization Microsoft Power BI is leading. Using this blog we are going to learn how to generate Embed token to host Power BI reports in any web application. Sometimes it will take hours to figure out how to embed token. Use these steps to do it in hour.
To embed Power BI report, it must be authorized by Azure AD. In regard of that we have to create Azure Ad application and give right permission. In case of Power BI Microsoft created a simple flow to register app and get Client ID and Client Secret code. Use this https://dev.powerbi.com/apps to register application in Azure. Similar screen will come to register application. For example I register DemoPowerBIApp.
Select Application type as server side web application. And add redirect URL.
In permission part select all –
Next step to assign right permission to created AD application. For that login to your Azure portal and go to Azure Active Directory and select created app in my case I selected “DemoPowerBIApp”. Select API permission and click on Grand Admin consent for application. For reference use this image.
Select Authentication left Navigation and add redirect URL. This setting is quite important to authorize your client domain to Azure token API. Add platform select web and add redirect URL. In our case it will be already added as we created app using above URL.
Also allow Default client Type to yes and save.
Next to use STW source code in our git report to get token – https://github.com/stw-services/PowerBIembedTokenSourceCode .
For test application you can use this URL – https://opensource.microsoft.com/ .
For any Power BI consultant connect us on info@softechworld.com.
Thanks,
Happy Programming!!