0
votes

I am trying to embed power BI Dash Board report into Web application.

1) I have configured the application using this Microsoft link and their sample application from github https://docs.microsoft.com/en-us/power-bi/developer/embed-sample-for-your-organization.

2) I have also tried configuring using this documentation https://bitbucket.org/omnistream/powerbi-api-example\

I am accessing the end point with my company email id /password . below is the details. i have admin rights on dash board report and I have power BI pro user account.

Post End point: https://login.microsoftonline.com/common/oauth2/token

Request Header : User-Agent: Fiddler Host: login.windows.net content-Type: application/x-www-form-urlencoded Content-Length: xxx

with request body : grant_type=password&scope=openid&[email protected]&password=MyPassword&client_id=XXXXX&resource=https://analysis.windows.net/powerbi/api&client_secret=XXXXX

it throws below error: error_description=AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password Trace ID: c13c59dc-79e2-4169-bae2-06c402310100 Correlation ID: a747a226-362a-45aa-956a-122629fa9863 Timestamp: 2018-08-06 21:27:59Z

Do i need to configure or create Master Power BI account separately ?

or if my company network interfering with Post request to mask the user id/password, is there any tool which can help me to trace this network issue?

1
Did you include your domain in MyUserName (i.e. [email protected]). Did you URI escape your username/password?Mankarse
its with domain name. updating the post to avoid confusion.kumar chandraketu
Everything looks fine to me in terms of the request you are sending (the only difference from my working configuration is that you are missing a / at the end of the POST endpoint). It is possible that you have not authorised the app (client_id) to access your user's ([email protected]) data. You can do this either through the azure admin portal, or by using one of the interactive authentication flows (which will pop up a checkbox asking for permission).Mankarse

1 Answers

0
votes

Even after Bypassing the company proxy for credentials it was not working. finally, I logged the ticket with Microsoft and able make it work for only one of the option i.e. Native application. Below is the step

1) Download 'App owns data ' application from here. And Register your power Bi application in Azure Portal as "Native application" for Application Type. Visit the link #1 in question for details about configuring PowerBI application web page embedding.

2) Open project and import all required Dll using NUget package manager.

3) configure cloud.config with these values in project.

  <appSettings>
  <add key="authorityUrl" value="https://login.microsoftonline.com/common/oauth2/authorize/" />
  <add key="resourceUrl" value="https://analysis.windows.net/powerbi/api" />   
  <add key="apiUrl" value="https://api.powerbi.com/" />
  <add key="embedUrlBase" value="https://app.powerbi.com/v1.0/myorg/" /> 
</appSettings>

4) Configure your web.config file with these values in project.

    <appSettings file="Cloud.config">
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />    
    <add key="applicationId" value="xxxxxxx-xxxx-xxxx-xxxx-xxxxxx" /> <!--For PowerBI Native application ID-->    
    <add key="workspaceId" value="xxxxxxx-xxxx-xxxx-xxxx-xxxxxx" />
    <!-- The id of the report to embed. If empty, will use the first report in group -->     
    <add key="reportId" value="xxxxxxx-xxxx-xxxx-xxxx-xxxxxx" />
    <!-- Note: Do NOT leave your credentials on code. Save them in secure place. -->
    <add key="pbiUsername" value="[email protected]" />
    <add key="pbiPassword" value="xxxxxxxx" />    
  </appSettings>

5) Publish your report on power BI site , create dash board , fill the report id and work space id in above web.config setting.

6) Execute the application. it should work for Embed report, dashboard and Tile types.