1
votes

I have setup roles in powerbi desktop. Can view as roles in desktop. But while embedding i'm getting this error

{
    code: 'InvalidRequest',
    message: 'Creating embed token with effective identity requires dataset to be provided'
}

My payload to token fetch API is

{
 accessLevel: 'View',
 "identities": [
    {
      "username": "username",
      "roles": [ "role" ],
      "datasets": ["datasetid"]
    }
     ]
}
1
Your payload is correct. I verified its the same as what I am sending. Are you sure that the DatasetId you are passing is valid? – vvvv4d

1 Answers

0
votes

If you are using an Analysis Services data source the Roles are not defined in the PowerBI report/pbix file like they are with a static/imported data. This is the method I am referring to: https://docs.microsoft.com/en-us/power-bi/report-server/row-level-security-report-server

To use Roles with Analysis Services you need to set up Roles on the tabular model itself. Microsoft has some good documentation how to do so here: https://docs.microsoft.com/en-us/power-bi/developer/embedded-row-level-security#working-with-analysis-services-live-connections

On this page look at "2. Create a Role in the Analysis Services server." and "3. Set your General settings. Here you give the Role Name and set the database permissions to Read only." This is how you create the role so you can pass "RoleA" or whatever you have called the role.

On the next steps "4. Set the Membership settings. Here you add the users that are affected by this role." and "5. Set your Row filters DAX query using the CUSTOMDATA() function." you can apply certain DAX filters to your role similar to how you can if you created a role in a PowerBI Pbix file for a static data set.