Forum Discussion

vospitannikov's avatar
9 years ago

Embed group report problem

I'm trying to integrate PowerBI report (located in group) into my page using iframe

I've registered AD application

I can query list of reports from the server side

But when I'm trying to use received "embedUrl" value using the same token I'm getting following error message:

"This content is not available.
Learn more about Power BI."

 

At the same time, if I open list of network requests in chrome DevTools, I can see the one request to some page ending in "modelsAndExploration" which return 401 error: Unauthorized

 

If I'm trying to open URL received in webUrl, I can successfully see report in PowerBI interface

 

Any suggestions/ideas?

28 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    vospitannikov wrote:

    I'm trying to integrate PowerBI report (located in group) into my page using iframe

    I've registered AD application

    I can query list of reports from the server side

    But when I'm trying to use received "embedUrl" value using the same token I'm getting following error message:

    "This content is not available.
    Learn more about Power BI."

     

    At the same time, if I open list of network requests in chrome DevTools, I can see the one request to some page ending in "modelsAndExploration" which return 401 error: Unauthorized

     

    If I'm trying to open URL received in webUrl, I can successfully see report in PowerBI interface

     


    vospitannikov

    Thanks for the clarification. I can embed the reports from groups well.

     

    Regarding the bold part, do you mean that in web Url, you can embed the reports from groups without problem? If yes, what do you mean "in webUrl"?

    • vospitannikov's avatar
      vospitannikov
      Helper I

      Hello Eric_Zhang

       

      Thank you for your response

       

      By "webUrl" I mean data received during requesting reports from API (please pay attention to bolded text below)

      http://docs.powerbi.apiary.io/#reference/report-preview/reports-collection/list-all-reports

       

      {
        "@odata.context": "https://api.powerbi.com/beta/myorg/$metadata#reports",
        "value": [
          {
            "id": "84dbd390--5eb9fe91cdba",
            "name": "AdventureWorks",
            "webUrl": "https:// app.powerbi.com/reports/84dbd390---5eb9fe91cdba",
            "embedUrl": "https://app.powerbi.com/embedReport?reportId=84dbd390--5eb9fe91cdba"
          }
        ]
      }

        

      I still facing the same problem during embedding group reports

      and located in my personal workspace reports can be embed without any problems

       

      Eric_Zhang, have you configured any special permissions for datasets/reports in order to let them be shared via embedding?

  • supermulder's avatar
    supermulder
    Frequent Visitor

    I have exactly the same issue.

     

    Embedding of my own reports works fine.

     

    I have created 4 groups in power bi - only one report in one group can be embedded without a Problem, all reports that are within the other 3 groups can not be embedded (401 Unauthorized) - the group permissions are all the same.

     

    Another problem:

     

    I have written a small javascript function to switch dynamicly between reports. At this moment i try to load a report that does not work (see above) some error-handling goes wrong and the function does not longer work, i´m not able to embed the working report anymore  - i think there is some error handling missing in your underlying powerbi.js framework. 

     

    function switchReport(id){
    var embedConfiguration = {
    type: 'report',
    id: id,
    accessToken: '{{AccessToken}}',
    embedUrl: 'https://app.powerbi.com/reportEmbed'
    };
    var $reportContainer = $('#reportContainer');
    var report = powerbi.embed($reportContainer.get(0), embedConfiguration);

    }


     

    • supermulder's avatar
      supermulder
      Frequent Visitor

      Some additional infos:

       

      - I can embed all reports that are attached to my workspace :smileyhappy:

       

      - I can only embed reports from other workspaces if i attached them to a group dashboard that is shared with my user 

       

      It seems that the group-permissions that i´ve configured in the group-configuration are not considered in the embedding process :-( So i´m only able to embed such reports in which i get a "permission" through the process of dashboard-sharing ...

       

      Is this a known issue at the moment ? I would appreciate any help! Thank you!

       

  • supermulder's avatar
    supermulder
    Frequent Visitor

    Thank you. I finally found a solution.

     

    I´m not using the powerbi-javascript-library anymore, regarding of the issue that it is not possible to set the groupid of a report at the moment.

     

    Instead i use the following javascript-code (based on the provided example).

     

    <script>
    
    function loadReportIntoIframe(reportId,groupId,iframeId){
        var iframe = document.getElementById(iframeId);
        var iframeUrl = 'https://app.powerbi.com/reportEmbed?reportId='+reportId;
        if (groupId){
            iframeUrl = iframeUrl + '&groupId=' + groupId;
        }
        iframe.src=iframeUrl;
        iframe.onload = postActionLoadReport;
    }
    
    // Post the access token to the IFrame
    function postActionLoadReport() {
        // Construct the push message structure
        // this structure also supports setting the reportId, groupId, height, and width.
        // when using a report in a group, you must provide the groupId on the iFrame SRC
        var m = {
            action: "loadReport",
            accessToken: 'YOUR_AAD_ACCESSKEY'
        };
        message = JSON.stringify(m);
    
        // push the message.
        iframe = document.getElementById('iFrameEmbedReport');
        iframe.contentWindow.postMessage(message, "*");;
    }
    </script>

    Sample:

     

    Loading a report from your worksspace:

     

    <a href="javascript&colon;loadReportIntoIframe('REPORT_ID','','IFRAME_ID')" >REPORT NAME</a>

    Loading a report from group:

    <a href="javascript&colon;loadReportIntoIframe('REPORT_ID','GROUP_ID','IFRAME_ID')" >REPORT_NAME</a>

    Next i will try to do the same with powerbi dashboards ...

    • BjoernLueers's avatar
      BjoernLueers
      Advocate II

      We have exactly the same problem. Embedding of personal reports still works perfectly (except in Chrome) but since recently group reports are not working anymore. We have been using the approach to add a groupID parameter to the report Url but we also tried to set group and report ID via post message with the same negative result.

    • mostojic's avatar
      mostojic
      Regular Visitor

      I've had the same problem... "This content is not available. Learn more about Power BI" message was showing everytime I tried to open embedded Power BI report in my application. Report was loaded only after I signed to Power BI account and refreshed the page with report in my application.

       

      However, everything is working fine after I applied the newest update (November) and published the report. 

       

      Thanks, Power BI team! :)