Embedding Power BI into an App

Step 1: Register app in Power BI

a. Go to the site power bi site here to register the app
b. Sign in with your Office account
c. Provide a proper App Name for the application to register
d. For App type choose “Native App” from the dropdown
e. Provide http://localhost:13526/redirect as Redirect URL
f. Provide http://localhost:13526/default as Home Page URL
g. Select all checkboxes in “Choose APIs to access”
h. Click on Register App button
i. You will get a Client ID just below the button. Keep a note of it that is important

Step 2: Embedding Power BI report into a Web App

a. Open sample program checked in under <<Location needs to be decided>>
b. Open Secrets.cs and provide the password of the Power BI account from which you wish to
fetch the reports along with the Client ID generated in Step 1
c. Open Program.cs and provide the user name of the Power BI account from which you wish
to fetch the reports
d. In the same Program.cs you will need to provide GroupId which you can get after logging
into your Power BI account using following steps:
1. Login into you Power BI account
2. Create a new Workspace by clicking on Workspaces > Create app Wprkspace
3. You will be getting a pop up like the following:

4. Provide a valid workspace name
5. Add any members if required
6. Click on Save
7. You will see a new workspace created
8. Click on the newly created workspace and check the URL
9. The URL will be in the following format
https://app.powerbi.com/groups/c536092f-53dd-4ea4-9694-3b5d65ad0ca5/contentlist
The highlighted portion is the Group ID

NOTE: You can use the code snippet with any of the existing apps and embed Power BI reports easily.e. Open a report deployed in the new workspace created in above step (#d) 3. In the same Program. Check the URL.cs you also need to provide ReportId which you can get after logging into your Power BI account using following steps: 1.powerbi.com/groups/c536092f-53dd-4ea4-9694- 3b5d65ad0ca5/reports/c5263693-dba3-4a83-968c-b4e39de13e3f/ReportSection The yellow highlighted portion is the Report ID while green highlighted portion is Group ID. the URL will be in the following format https://app. . Login into you Power BI account 2.