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
Anonymous
Not applicable

PowerShell - Adding Power BI user in workspace

Hi All,

 

I am trying to add user in workspace from PowerShell script which works but if a user is already a member of it, it will fail. What I am trying to achieve is whatever latest information I provide should be followed i.e. if user was admin previously & in new script run, if it is degraded to viewer then that should work. I am using "Add-PowerBIWorkspaceUser" to achieve this, but it is failing with error :

 

Add-PowerBIWorkspaceUser : Operation returned an invalid status code 'BadRequest' 

 

Any ideas?

 

Thanks in advance!

Max

1 ACCEPTED SOLUTION
ibarrau
Super User
Super User

Hi. Well the method says Add. So I guess it only adds. I'm not familiarized with power bi cmdlets, but I haven't seen a way to solve this using only that. However I know the API, it would let you build a script to fix it. You can try catch the exception and try an update of the user like the doc 

https://learn.microsoft.com/en-us/rest/api/power-bi/groups/update-group-user

That request let you update a user permission at a workspace.

I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

View solution in original post

2 REPLIES 2
ibarrau
Super User
Super User

Hi. Well the method says Add. So I guess it only adds. I'm not familiarized with power bi cmdlets, but I haven't seen a way to solve this using only that. However I know the API, it would let you build a script to fix it. You can try catch the exception and try an update of the user like the doc 

https://learn.microsoft.com/en-us/rest/api/power-bi/groups/update-group-user

That request let you update a user permission at a workspace.

I hope that helps,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

This helps a lot, I can build a solution on this. Thanks!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors