Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I'm struggling with this since a week... I have tried so many things, read so many documentations (walkthrough), I can't find any solutions and I have lost the clarity. I really need your help.
I want my users to signin on my app (through devise), then access to some pages and see embedded PowerBI Tiles (or report, or dashboard maybe). Then I want them to be able to filter the results. A client-side example is https://microsoft.github.io/PowerBI-JavaScript/demo/filters.html.
I want to be able to do the same.
I'm lost with all the client id, secret, ressource uri, ressource url, ...
What solution/walkthrough must I use?
Thank you so much for your time,
François
Carefully?
Seriously though, seems like this article should get you there:
https://powerbi.microsoft.com/en-us/blog/intro-pbi-js-api/
I believe a prerequisite to this is Power BI Embedded although I may be confused on that point.
https://azure.microsoft.com/en-us/services/power-bi-embedded/
I used this walkthrough when I did it:
https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-get-started-sample/
Thank you for your answer.
Carefully? Yes 🙂
Well, the JS API is not what I'm struggling with. It's the last thing to check on my todo. And I don't want to create a .Net project, but a Rails one. The basic process are the same, I understand that.
Here's a bunch of questions, thank you for your expertise & advices :
#1
Do I need to register an application for Power BI with https://dev.powerbi.com/apps?type=web ?
(I've already done that)
#2
Do I need to create an ActiveDirectory (and a Azure User) ? Then add an application wich authorize Power BI Service?
(I've already done that)
#3
Do I need to create a Workspace for Power BI Embedded here https://portal.azure.com/#create/Microsoft.PowerBI ?
To me it seems there's to many ways to implement Power BI Embedded in a web app. I am lost.
Thank you
My understanding of the process and how I have gotten it to work, yes, you need to do #3. The sample application walkthrough provides a .NET command-line application and instructions for registering your Power BI Embedded instance and setting up and configuring it, etc. At least, that's what I remember.
Ok, so you never had to follow that walkthrough?
https://powerbi.microsoft.com/en-us/documentation/powerbi-developer-integrate-tile/
Nor that one?
https://msdn.microsoft.com/en-us/library/mt186158.aspx
(Oo)
I can feel you pain, I got very confused reading the documentation when trying to setup Embeding.
Not fully the fault of the documentation, it's more to do with the different functionality being released at different times so older documentation speaks to functionality that embed is better for now.
For your requirements of having a rails app that the user logs in and views reports then Embedded is the recommended way with the exception if it is internal (users trusted) then Azure can be used.
The Azure application method being for internal users as the token is exposed (if they go looking for it)..
The embed method needs a server iin the middle that generates short term tokens to the user.
The "server in the middle" part I go stuck at for week 😞 .
The JS example you referenced if you clone it and review or look at source you can see it calls a server than returns the requried data. So for your rails app you need to build/create a server that handles that task...
Hope that helps - I'm not fully there yet either so don't take this as definitive!
Hi metricsman, thank you for sharing your experience.
I'm trying different things right now, hoping I will find a clear solution.
Eventually I'll post it here.
Cheers
Good luck, it definitely seems to be something that is more complicated than initially though.
Great to hear your solution once you get there!
Hi,
To succeed I had to forgot everything I had read before... and start again with this:
https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-iframe/
ON AZURE PORTAL
Create Power BI workspace collection, and get access key (Provisioning)
GET A PBIX
From Power BI Desktop or a sample file
WITH A CLI
(must use that one : https://github.com/Microsoft/PowerBI-Cli )
Create a Power BI workspace
Import .pbix file into the workspace
Get report id
IN MY RAILS APP
(using https://github.com/jwt/ruby-jwt )
Embed the report into the web page
I can't tell about the many bugs encountered, or the signup/login problems with Azure... it was really painful to get there.
Cheers everyone.
Congratulations !
Agree on the bugs, even the CLI not running on mac took me a few hours to work out
Can I ask so you are using just the main access key not generating a short time key ?
If so how to secure it or not a factor in your use case.
Thanks.
Hi there.
I'm not sure to understand your question, most of the things I've done so far are beyond my own comprehension 🙂
I'm using the "KEY 1" associated with the WorkSpace collection created on Azure portal.
Maybe this will help you.
Here's the CLI commands:
$ powerbi get-workspaces -c MyWorkspaceCollection -k TheVeryLongKey1IHaveCopiedOnTheAzurePortal123456789= $ powerbi create-workspace -c MyWorkspaceCollection -k TheVeryLongKey1IHaveCopiedOnTheAzurePortal123456789= $ powerbi import -c MyWorkspaceCollection -w TheWorkspaceIDIHaveJustCreated54321 -k TheVeryLongKey1IHaveCopiedOnTheAzurePortal123456789= -f ~/Downloads/Retail\ Analysis\ Sample.pbix -n "Retail Analysis Sample" $ powerbi get-reports -c MyWorkspaceCollection -w TheWorkspaceIDIHaveJustCreated54321 -k TheVeryLongKey1IHaveCopiedOnTheAzurePortal123456789=
In Rails, my controller is:
require 'jwt' class JwtController < ApplicationController ACCESSKEY = "TheVeryLongKey1IHaveCopiedOnTheAzurePortal123456789" TOKEN1 = { "typ" => "JWT", "alg" => "HS256", "wid" => "TheWorkspaceIDIHaveJustCreated54321", "rid" => "TheReportIDIHaveRetreived134679", "wcn" => "MyWorkspaceCollection", "iss" => "PowerBISDK", "ver" => "0.2.0", "aud" => "https://analysis.windows.net/powerbi/api", "nbf" => Time.now.to_i, "exp" => Time.now.to_i + 4 * 3600 } def connect @token = JWT.encode TOKEN1, ACCESSKEY, 'HS256' end end
Finally, the view:
<button id="btnView">View Report !</button> <div id="divView"> <iframe id="ifrTile" width="100%" height="400"></iframe> </div> <script> (function () { document.getElementById('btnView').onclick = function() { var iframe = document.getElementById('ifrTile'); iframe.src='https://embedded.powerbi.com/appTokenReportEmbed?reportId=TheReportIDIHaveRetreived134679'; iframe.onload = function() { var msgJson = { action: "loadReport", accessToken: "<%= @token %>", height: 800, width: 800 }; var msgTxt = JSON.stringify(msgJson); iframe.contentWindow.postMessage(msgTxt, "*"); }; }; }()); </script>
Hope, it will help you or anyone else.
Cheers
I think your understand is better than mine...
Haven't used Rails but I think it's if the accesskey in the controller can be seen by an end-user they then can access the workspace.
That was form: https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-iframe/
"But, when we embed the report in our web page, this kind of security information would be handled using JavaScript (frontend). Then the authorization header value must be secured. If our access key is discovered by a malicious user or malicious code, they can call any operations using this key."
So I've gone some complicated path of having a used call an "api" that uses the accesskey to return the shorter term token - same as what your controller does I think.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
1 | |
1 | |
1 |