- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can I update Row-level security via Rest API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you mean can you add users to an RLS role you defined in the pbix file, then the answer is yes,
You can get a list of the roles in a specified report with a call like
http://localhost/reports/api/v2.0/PowerBIReports(1fe72f5d-5cce-43c2-905b-fe699ed9a46a)/DataModelRoles
You would use the /DataModelRoleAssignments endpoint
eg.
http://localhost/reports/api/v2.0/PowerBIReports(1fe72f5d-5cce-43c2-905b-fe699ed9a46a)/DataModelRoleAssignments
You would do a GET request to get the all the current users in your RLS roles, then you would post back a new array with any new users added (or remove users who should no longer have access). Note that this array will replace the entire list of users.
The following would add user1 and user2 to a specific role.
[ { "GroupUserName": "user1", "DataModelRoles": [ "ef5680de-2218-4c40-b308-831ce3d108b4" ] }, { "GroupUserName": "user2", "DataModelRoles": [ "ef5680de-2218-4c40-b308-831ce3d108b4" ] } ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Power BI Report Server uses Windows Authentication by default. I know in PowerShell you can just use the -UseDefaultCredentials switch of the Invoke-RestMethod cmdlet to send the windows credentials. You will have to search for something like "python rest api windows authentication" in google or bing for information on how to do this in Python - it probably depends on what rest module you are using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot.
I found the python way. I'd like to share the pkg and code with everyone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you mean can you add users to an RLS role you defined in the pbix file, then the answer is yes,
You can get a list of the roles in a specified report with a call like
http://localhost/reports/api/v2.0/PowerBIReports(1fe72f5d-5cce-43c2-905b-fe699ed9a46a)/DataModelRoles
You would use the /DataModelRoleAssignments endpoint
eg.
http://localhost/reports/api/v2.0/PowerBIReports(1fe72f5d-5cce-43c2-905b-fe699ed9a46a)/DataModelRoleAssignments
You would do a GET request to get the all the current users in your RLS roles, then you would post back a new array with any new users added (or remove users who should no longer have access). Note that this array will replace the entire list of users.
The following would add user1 and user2 to a specific role.
[ { "GroupUserName": "user1", "DataModelRoles": [ "ef5680de-2218-4c40-b308-831ce3d108b4" ] }, { "GroupUserName": "user2", "DataModelRoles": [ "ef5680de-2218-4c40-b308-831ce3d108b4" ] } ]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@melanid wrote:
I am not able to make it work, do you know if the API was deleted?
No, It's definitely still there as a documented API. What do you mean by "not able to make it work" - are you getting an error message of some sort? If so can you share more about what you are attempting to do and what error you are getting?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for your response!
I tried to use it like you describe (I want to retrieve the list of configured RLS for a specific dataset) : http://localhost/reports/api/v2.0/PowerBIReports(DATASETID)/DataModelRoles
But in my case, we have PowerBI Pro Licences, does it only work with on-premise licences?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@melanid wrote:
does it only work with on-premise licences?
Yes, this forum is dedicated to the on-prem Report Server.
The only way to update RLS on the service using an API is via the XMLA endpoint and you need a premium license for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi d,
What XMLA endpoint is that? I have a premium license and would like to try it. What does it look like calling it? Does that work for PowerBI online? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@hpdev wrote:
Hi d,
What XMLA endpoint is that? I have a premium license and would like to try it. What does it look like calling it? Does that work for PowerBI online? Thanks!
If you have a premium capacity or premium per user workspace you would need to enable the endpoint for read/write (see Semantic model connectivity and management with the XMLA endpoint in Power BI - Power BI | Microsoft... ) and you can get the xmla endpoint address from the workspace settings under "License Info" and it's listed as the "Connection Link"
Then you can use a script similar to the following example to update a role.
Uses the XMLA endpoint to add a user to a role for a Power BI dataset (github.com)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can we do this by using Power shell cmdlets directly without using powerbi REST API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot.
I can use chrome to get the response.
But when I try to use python requests to get, I met 401, I guess it was unauthorized.
Do you know how can I pass my account and pwd via Rest API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Power BI Report Server uses Windows Authentication by default. I know in PowerShell you can just use the -UseDefaultCredentials switch of the Invoke-RestMethod cmdlet to send the windows credentials. You will have to search for something like "python rest api windows authentication" in google or bing for information on how to do this in Python - it probably depends on what rest module you are using.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does this work for PowerBI online? I assume PowerBI report server is the local version correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot.
I found the python way. I'd like to share the pkg and code with everyone.

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
02-13-2025 02:31 PM | |||
01-30-2025 01:42 PM | |||
07-14-2024 04:13 AM | |||
06-06-2024 02:51 AM | |||
01-12-2025 08:45 AM |
User | Count |
---|---|
10 | |
4 | |
4 | |
2 | |
1 |
User | Count |
---|---|
9 | |
6 | |
5 | |
4 | |
4 |