Forum Discussion

shaw's avatar
shaw
Frequent Visitor
6 years ago
Solved

400 Bad Request Error when embedding report

I am trying to embed the Power BI report into 3rd party web app. Trying to test this in Java Code Sample. I am able to authenticate, and in fact, get the response with the correct reportId, groupId. ...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi shaw 

    If you are using the 'App owns data' type of embedding + using the Service Principal to generate embedding tokens, then this Identity section of the token request should contain details of the 'user' used for Row Level Security purposes.

    Are you reports/dashboards using Row Level Security?
    If so... your identity section should look like this...

    "identities": [
        {
          "username": "[email protected]",
          "roles": [
            "My PBI Role Name"
          ],
          "datasets": [
            "cfafbeb1-8037-4d0c-896e-a46fb27ff229"
          ]
        }
      ]

     

    Username can be any value - you are effectively impersonating this person - and this has no link to any account in your Azure tenant or Power BI access list.

    Roles should contain any Power BI (RLS) roles that you have defined inside your data model. Note that you should not supply roles here if you are not using RLS - and dont supply roles that dont exist in your model. Again, this is not a role that belongs to your Service Principal account or any other Power BI account type (admin/member/viewer) etc..

    Hope this helps,
    Cheers - Matt