Showing results for 
Search instead for 
Did you mean: 
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:




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!

Helpful resources

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors