Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
MaartenInc
Frequent Visitor

Embed BI, App owns data, dynamic RLS multiple effective identities

 

The documentation (https://learn.microsoft.com/en-us/rest/api/power-bi/embed-token/generate-token#examples) contains quite some examples on how to generate a token. But our use case does not seem to be documented. We are confused whether we are trying to use dynamic RLS in the wrong way. Or are just generating our embedded token incorrectly.  

 

Our token request looks as follows: 

 

{
  "datasets": [
    {
      "id": "3bff762b-...-1e1dabe41b3e"
    }
  ],
  "reports": [
    {
      "id": "e16f0244-...-97ceda22e823"
    }
  ],
  "targetWorkspaces": [
    {
      "id": "beca21a6-...-17f65322eb31"
    }
  ],
  "identities": [
    {
      "username": "user.name@domain.be",
      "datasets": [
        "3bff762b-...-1e1dabe41b3e"
      ],
      "roles": [
        "EMAIL"
      ]
    },
    {
      "username": "BusinessDefault",
      "datasets": [
        "3bff762b-...-1e1dabe41b3e"
      ],
      "roles": [
        "CompanyCode"
      ]
    },
    {
      "username": "Default",
      "datasets": [
        "3bff762b-...-1e1dabe41b3e"
      ],
      "roles": [
        "DomainCode"
      ]
    },
    {
      "username": "Business",
      "datasets": [
        "3bff762b-...-1e1dabe41b3e"
      ],
      "roles": [
        "SystemCode"
      ]
    },
    {
      "username": "Administrators",
      "datasets": [
        "3bff762b-...-1e1dabe41b3e"
      ],
      "roles": [
        "DatabaseRole"
      ]
    }
  ]
}

 

 

 

This results in the API responding with following error: 

 

Status: BadRequest (400)
Response: {"error":{"code":"InvalidRequest","message":"Multiple identities provided for dataset 3bff762b-c82b-4256-9ed2-1e1dabe41b3e"}}

 

 

 

We've tried removing the datasets parameter in the identities, only provide it to one identity, ... But every possible scenario gives us an exception when generating the token.  

When just using one identity, the token generates fine.  But the moment we add a second identity. Things no longer seem to work.  

 

 

 Our report datamodel looks as follows:

  • Any datasource should be filtered on the current DomainCode (consider this a tenant or organization unit)
  • We are reporting on the 'Actions' table. A user should only be able to see the 'Actions' which he is assigned to. Unless if he has the DatabaseRole "Administrators".  An Administrator can see every users his information.
  • Our 'Actions' have a related table 'CompanySites'. A CompanyCode can be associated to multiple CompanySites.
    • The user can see all the 'CompanySites' to the provided CompanyCode
    • The report has a slicer where the user can filter on a selected CompanySite

 

 

4 REPLIES 4
MaartenInc
Frequent Visitor

any additional help would be appreciated. We haven't been able to make progress on this issue.

In "App owns data" you are generating a token for the user who views the embedded report. Power BI has no knowledge about that user. Only your application has that knowledge. The way to tell Power BI which RLS context (role, userename, etc.) should be used for the current user viewing the report is with the effective identity.

So why are you providing more than 1 effective identity for the same dataset? How will Power BI know which of those identities should be used when fetching the data from the dataset? I believe there should be a single identity with only 1 username. and possibly multiple roles.

 

Anonymous
Not applicable

HI @MaartenInc,

I'd like to suggest you take a look at the following link that mention similar issue if it helps with your scenario:

Solved: Re: Embed BI, App owns data, dynamic RLS multiple ... - Microsoft Power BI Community

Regards,

Xiaoxin Sheng

Thanks for the quick response @Anonymous. Unfortunately the solution provided in that question doesn't solve the issue. 

 

The "username" values are different are also different across the roles.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.