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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Dave_nei
New Member

Setting user role to Viewer using API

Hi everybody.

 

The Viewer role has been up for a while now but as far as I know, you can't set it via API.

 

Apparently back in July 2019 this was already going on (check Can Viewer Role be set via API? ) but I can't help thinkin it's impossible that such feature is still NOT implemented. I'm begining to think that there's another way to do this that I'm unaware of because it doesn't sound right that this can't be done.

 

I'm totally able to share a workspace with a user via API and set him roles of:

  • Admin
  • Contributor
  • Member

But all of these roles are read/write so it doesn't work for me (and I'm sure for a LOT of other people too). When I try to set the role as "Viewer" via API I get this message:

 

"UnsupportedAccessRight"

 

The funny thing is, if I set the role to VIEWER manually from the powerbi service website, and I make a GET petition to check out the user's role for the workspace I set him up as a viewer, the response is that the user has INDEED the Viewer role, so the role APIwise is there, it exists, and can be seen.

 

So... is there a way to ser a workspace to readOnly=true or similar (another parameter that doesn't seem to work in the POSTs)

 

In the end, what I need is a way to set up ALL my workspaces that are shared with users, and make all those users VIEWERS or equivalent scenarios so my RLS work and users can't access the Datasets or edit the Reports.

 

All of this via API or code (Powershell etc...) because manually doing it is not an option for me.

 

Any ideas? 

 

Many thanks for everything!

1 REPLY 1
Embedded82
Frequent Visitor

I would like to spend a few minutes of my time to explain, once more, why not having such opportunity via API is unacceptable! 

As @Dave_nei said, the community was already requesting this back in 2019 as soon as the Viewer role was released.

In my organization we create and manage Power BI workspace massively through automation with Azure DevOps pipelines and not having the feauture of adding the Viewer role makes our automation not a real automation since we need to go back manually in every workspace.

Microsoft can you please take care of this since it was logged in GitHub as an issue back in August 29 2019?

You can check yourself here.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.