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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
BalaGrandhi
New Member

RLS not working with CUSTOMDATA() in App Owns Data semantic model

I have a semantic model on which RLS is working with Username() when I use power BI embedding functionality. Now I want to consume that semantic model in our other application using C# libraries like TOM, ADOMD.net and I want to filter out the data using RLS. For that I am passing in Customdata() in connection string and I updated semantic model as well to use the same Customdata() in RLS to filter data.

 

In my code I see Customdata() is passing fine in connectivity to semantic model but when I try to retrieve records of the table using DAX( EVALUATE TOPN({10},TableName) expression I am not getting the filtered records as per RLS. I am getting the entire table data.

 

string connectStringUser = $"DataSource={workspaceConnection};User ID={userId};Password={password};CustomData={username};";

AdomdConnection advwrksConnection = new AdomdConnection(connectStringUser);

advwrksConnection.Open();

AdomdCommand cmd2 = new AdomdCommand("EVALUATE TOPN({500},TableName)", advwrksConnection);

DataTable results = new DataTable();
AdomdDataAdapter adaptor = new AdomdDataAdapter(cmd2);
adaptor.Fill(results);

 Since this is app owns data, the username and password is of service account.

2 REPLIES 2
Anonymous
Not applicable

Hi @BalaGrandhi ,

Have you solved your problem yet? If so, you can mark the correct answer as solution.

Best Regards,

Xianda Tang

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

Anonymous
Not applicable

Hi @BalaGrandhi ,

You can follow this step:

   1.Log the value you’re passing in the connection string to ensure it’s correct.Verify that the Customdata is being correctly interpreted by the semantic model.

   2.Confirm that the RLS rules are correctly applied to the relevant tables.

   3.Since this is an “app owns data” scenario, ensure that the service account (used for the connection) has the necessary permissions to access the data and apply RLS.

Below is the link will help you:

Connection string properties (Analysis Services) | Microsoft Learn

Best Regards,

Xianda Tang

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.