There is a lot of interest surrounding Power BI Embedded from organizations looking for cost-effective ways to embed customer-facing (external) reports in custom apps. And there will be even more interest now that Microsoft reduced the Power BI Embedded cost dramatically by switching from per-render to a session-based pricing model. The best way to get started with Power BI Embedded is with the Microsoft sample app, which is well documented here. Here are a few notes for a better configuration experience:
- Register a native Azure app even if your custom app is web-based. That’s because the ProvisionSample console app (inside the sample solution) expects to be configured in Azure as a native app.
- Instead of using the Azure Portal, the easiest way to register the app is to go to http://dev.powerbi.com/apps. On the registration page, specify app name (it should typically correspond to your web app name although you can enter anything), and then enter https://login.live.com/oauth20_desktop.srf as a redirect URL because it’s hardcoded in the ProvisionSample app. Once you register the app, the registration page will give you the client id, which you need to enter in the App.config file of the ProvisionSample app, together with your subscription id, azureresourcegroup, and access key (the most important piece) of your Power BI Embedded Service. You can obtain the subscription id, access key, and azureresourcegroup settings from the Power BI Service page as explained here.
Apparently, something has changed in Azure but trying to run the ProvisionSample app gave me an error “AADSTS65005: The client application has requested access to resource ‘https://management.core.windows.net/’. This request has failed because the client has not specified this resource in its requiredResourceAccess list“. To fix this, follow these steps:
- Go to the Azure Portal (http://portal.azure.com), click More Services, then Active Directory.
- Click the Applications tab and then change the Show drop-down to “Applications my company owns” and then click the checkmark next to it.
- Click the application you just registered (PowerBIEmbeddedDemo in my case). In the application page, click Configure.
Click the “Add application” button and add the “Windows Azure Service Management API” application. Expand the Delegated Permissions drop-down and check the only permission there. You need to delegate the necessary permissions to the Power BI Service.
Now you should be able to run the ProvisionSample console app successfully. If you still have issues, verify the configuration settings in the App.config file.