Forum Discussion

mda's avatar
mda
Icon for Advocate I rankAdvocate I
9 years ago
Solved

Embedding report in external app with non-Power BI users

Hi,   I'm trying to embed a report in an external application. To do this I performed all steps described in How to embed your Power BI dashboards, reports and tiles.   App registration was done...
  • Eric_Zhang's avatar
    9 years ago

    mda

    1. The registered Azure APP doesn't have anything to do with Power BI reports except to get the accesstoken. If you want to embed your reports in an external application you have to publish it to PowerBI service,

    2.You could get the accesstoke and embedded token via two REST APIs as below.

    --get the access token
    POST /common/oauth2/token HTTP/1.1
    Host: login.windows.net
    Cache-Control: no-cache 
    Content-Type: application/x-www-form-urlencoded
    
    client_id=49dxxxxxxxthe register app client idxxxxx0-6d93f770d1a4&grant_type=password&resource=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi&username=yourpowerbiaccount&password=yourpowerbipassword

    --To get the embedded token for a report/dashboard/tile
    --reference https://msdn.microsoft.com/en-us/library/mt784614.aspx

    POST /v1.0/myorg/groups/dc5811-YOURGROUPID-f16b6c15/reports/16d21d5a-YOURreportID--46a2fd9/GenerateToken HTTP/1.1
    Host: api.powerbi.com
    Content-Type: application/json
    Authorization: Bearer theTokenFromPriorAPI
    Cache-Control: no-cache

    {
    "accessLevel": "View"
    }

    3. Yes, it needs a Premium licence if you want to use  Embedding with non-Power BI users (app owns data). For cost-saving, a more simpler approach would be using Publish to web, you don't have to apply option 1&2.