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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Use row-level security (RSL) need to set for embedded report

I have one table where I have to check two roles. One is "TenantID" and User Level. Can you please help with this.

 

TenantID = username() && User Level = username() 

 

Above this, I set the roles?

 

Report should be filtered via Tenant and then user level role.  

 

Please let me know how to call this role in embedded code 

 

var generateTokenRequestParameters = new GenerateTokenRequest("View", null, identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: "username", roles: new List<string> { "roleA", "roleB" }, datasets: new List<string> { "datasetId" }) });

var tokenResponse = await client.Reports.GenerateTokenInGroupAsync("groupId", "reportId", generateTokenRequestParameters);

 

or 

 

{ "accessLevel": "View", "identities": [ { "username": "EffectiveIdentity", "roles": [ "Role1", "Role2" ], "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ] } ] }

image.png

 

 

 

1 REPLY 1
v-jiascu-msft
Employee
Employee

Hi @Anonymous,

 

Please mark the private information.

May I ask if it's necessary to use two conditions? You can do it in the local application. For example, even if there are two users have same userID, the pseudo-code is as below.

if TenantID = "T001" && UserID = "Nilesh" then
    {
    "accessLevel": "View",
    "identities": [
        {
            "username": "Nilesh",
            "roles": [ "Role1", "Role2" ],
            "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ]
        }
    ]
}

else if TenantID = "T002" && UserID = "Nilesh" then
 {
    "accessLevel": "View",
    "identities": [
        {
            "username": "Nilesh",
            "roles": [ "Role3", "Role4", "Role5" ],
            "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ]
        }
    ]
}

Finally, different users get different tokens.

Reference: embedded-row-level-security#applying-user-and-role-to-an-embed-token

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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