Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17897

Use row-level security with Power BI embedded content

$
0
0

Hi All,

 

I'm trying to embed Power BI reports in a Web Application and I'm following this tutorials 

Embed a Power BI report for your customers    

Use Row-Level Security with Power BI embedded

and using the base code from Github sample App Owns Data Sample

 

My Power BI Reports are connected to an Azure Analysis Service Model and there I have some roles created to test the

Row-Level Security.

 

I'm trying to pass a test username from the app to the AAS Model in order to restrtric the data they can see based on the Roles created. Here's my code:

 

 

var rls = new EffectiveIdentity("guest@contoso.com", new List<string> { report.DatasetId }, null, "guest@contoso.com");
if (!string.IsNullOrWhiteSpace(roles))
{
   var rolesList = new List<string>();
   rolesList.AddRange(roles.Split(','));
   rls.Roles = rolesList;
}
// Generate Embed Token with effective identities.
generateTokenRequestParameters = new GenerateTokenRequest(accessLevel: "view", identities: new List<EffectiveIdentity> { rls });

But I get this error when trying to see the embedded report:

 

"Creating embed token for accessing dataset xxxxxxxxxxx requries effective identity username to be identical to the caller's principal name"

 

If I pass the caller's principal username the report obviusly works ok., but I want to pass another username to test 

Row-Level security. As you can see I'm also passing a value to CUSTOMDATA() property, which is being used in a DAX for one of my roles but my data is not being filtered correctly

 

Capture.PNG

 
Does anyone have and Idea on what could be happening or if I missing something?

 

Regards,


Viewing all articles
Browse latest Browse all 17897

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>