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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
MichaelBluth
Regular Visitor

Problem with PBI embedded + app only auth + RLS

I have a report where I've created a role "customer" with DAX expression "[ColumnName] = USERNAME()". I'm trying to get an embed token for this report through the C# API using app only auth:

string applicationId = "***", applicationPassword = "***",
  datasetId = "***", groupId = "***", reportId = "***";

var context = new AuthenticationContext("https://login.microsoftonline.com/tenantId/");
var clientCredential = new ClientCredential(applicationId, applicationPassword);
var result = context.AcquireTokenAsync("https://analysis.windows.net/powerbi/api", 
  clientCredential).Result;
var authHeader = new TokenCredentials(result.AccessToken, "Bearer");
var client = new PowerBIClient(new Uri("https://api.powerbi.com"), authHeader);
var tokenRequest = new GenerateTokenRequest(TokenAccessLevel.View,
  datasetId, new EffectiveIdentity("42", new List<string> { datasetId },
  new List<string> { "customer" }));
var embedToken = client.Reports.GenerateTokenInGroupAsync(new Guid(groupId),
  new Guid(reportId), tokenRequest, cancellationToken: CancellationToken.None).Result;

 

When I call the GenerateTokenInGroupAsync method, I get a Bad Request error with the following message: "InvalidRequest: Creating embed token for accessing dataset <datasetId> shouldn't have effective identity". What am I doing wrong here?

 

Thanks in advance

2 REPLIES 2
lbendlin
Super User
Super User

My takeaway from the presentation today is that RLS is not supported in the "App owns data"  model.

 

https://github.com/PowerBiDevCamp

I looks like that might be the case.. Do you have any advice for an approach in my case where we'd like to offer embedded reports to our customers - we're looking at starting with one report with a dataset containing all customers' data. What is the "correct" approach for this case? One report, but with a unique dataset for each customer?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.