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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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