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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Karthik_Siva
New Member

Embed - Effective Identity

Folks,

 

I am trying to setup a small web portal using Python Flask for my client to embed the Power BI Reports. I have used the Service Principal Approach and it all works fine and we are able to see the report.

 

Since I used the Service Principal, I want to now try out how to enable Row Level Security by passing the Logged in user of the web portal to Power BI embed token using Effective Identities.

 
 
I get 2 conflicting error messages
Message 1: Creating embed token with effective identity requires dataset to be provided
Message 2: Creating embed token for accessing dataset 1e2c6b9e-1e2c6b9e-1e2c6b9e-XXYYXX shouldn't have effective identity
 
Some more details on the way I am invoking
api_response = requests.post(embed_token_api, data=json.dumps(request_body.__dict__), headers=self.get_request_header())
 
And request.body has among other things the following 
Error Message 1 : 
        request_body.identities.append(
            {
                'username': 'emailid@domain.com',
                "roles": ["Owner"],
                 << I have not given any dataset list here>>
             }
            )
400 - {"error":{"code":"InvalidRequest","message":"Creating embed token with effective identity requires dataset to be provided"}}
127.0.0.1 - - [01/Apr/2024 14:56:40] "GET /powerbi/report/1 HTTP/1.1" 500 -
***************************************************************************************************
 
So, I added the dataset to the request body like below
Error Message 2 : 
 
        request_body.identities.append(
            {
                'username': 'emailid@domain.com',
                "roles": ["Owner"],
                "datasets":['1e2c6b9e-1e2c6b9e-1e2c6b9e-XXYYXX'],
            }
            )
 
400 - {"error":{"code":"InvalidRequest","message":"Creating embed token for accessing dataset 1e2c6b9e-1e2c6b9e-1e2c6b9e-XXYYXX shouldn't have effective identity"}}
127.0.0.1 - - [01/Apr/2024 15:06:00] "GET /powerbi/report/1 HTTP/1.1" 500 -
  
Any help is much appreciated 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @Karthik_Siva 

According to your description, you encountered the following two errors while performing a series of operations.


Error Message 1: This error occurs because you must specify the dataset to which RLS will be applied when you attempt to create an embedded token with a valid logo. The valid token needs to know which dataset it should apply the RLS rule to.

Error Message 2: This error indicates that there may be a misunderstanding on how to apply the valid token to a dataset. This error may be encountered if the dataset you are trying to access does not have RLS set, or if there is a problem with how the dataset is specified.

So, you can refer to the following steps to resolve it.
1. Ensure that row-level security is properly configured on the dataset in Power BI. This setup needs to be done in the Power BI service or Desktop before it can be used through the API.
Row-level security (RLS) with Power BI - Power BI | Microsoft Learn
2.When you're appending identities to your request body, ensure that you're correctly specifying the dataset ID.
Generate an embed token in Power BI embedded analytics - Power BI | Microsoft Learn

If you continue to encounter problems, use the error objects returned by the Power BI JavaScript SDK mentioned in the troubleshooting guide to gain more insight into what may be going wrong.
Troubleshoot Power BI embedded analytics application - Power BI | Microsoft Learn

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum




View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @Karthik_Siva 

According to your description, you encountered the following two errors while performing a series of operations.


Error Message 1: This error occurs because you must specify the dataset to which RLS will be applied when you attempt to create an embedded token with a valid logo. The valid token needs to know which dataset it should apply the RLS rule to.

Error Message 2: This error indicates that there may be a misunderstanding on how to apply the valid token to a dataset. This error may be encountered if the dataset you are trying to access does not have RLS set, or if there is a problem with how the dataset is specified.

So, you can refer to the following steps to resolve it.
1. Ensure that row-level security is properly configured on the dataset in Power BI. This setup needs to be done in the Power BI service or Desktop before it can be used through the API.
Row-level security (RLS) with Power BI - Power BI | Microsoft Learn
2.When you're appending identities to your request body, ensure that you're correctly specifying the dataset ID.
Generate an embed token in Power BI embedded analytics - Power BI | Microsoft Learn

If you continue to encounter problems, use the error objects returned by the Power BI JavaScript SDK mentioned in the troubleshooting guide to gain more insight into what may be going wrong.
Troubleshoot Power BI embedded analytics application - Power BI | Microsoft Learn

Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum




Thanks a lot! with your comments as guide i can solve the problem. Really appreciate!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.