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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Row level security python

Hello, 

I have this python code to generate access token with power bi embedded, it is working fine, but I want to add the identities parameter to take into account rls functionality

 

Here is the python code:

    def __init__(self, report_id, group_id, settings=None):
        self.username = 'MyUserName'
        self.password = 'MyPassword'
        self.client_id = '28c7e68d-6eb1-4be3-8b97-4c0fa9cd83d7'
        self.report_id = report_id
        self.group_id = group_id
        if settings is None:
            self.settings = {'accessLevel': 'View', 'allowSaveAs': 'false'}  
        else:
            self.settings = settings
        self.access_token = self.get_access_token()
        self.config = self.get_embed_token()


I think that identities should be added at this line :

self.settings = {'accessLevel': 'View', 'allowSaveAs': 'false'}


For more clarification I have a C# code that is working fine :

generateTokenRequestParameters = new GenerateTokenRequest("View", null, identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: "EffectiveUserName", roles: new List<string> { "FranceSales" }, datasets: new List<string> { "382ea16c-fbcc-4cec-bb60-470aff4aebaa" }) });

 

1 REPLY 1
v-micsh-msft
Microsoft Employee
Microsoft Employee

Hi,

 

What is your current situation?

The generate Token API is used to generate EmbedToken.

I am not familiar with Python, just from the code structure you posted, I agree that the identities should be configured with the settings part.

Let us know if it works.

 

Regards,

Michael

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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