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
viji123
Frequent Visitor

How to remove the access of multiple users from a workspace easily?

Hi all!

I have a workspace to which more than 500 users who have access.

Now i need to remove all users except the 2 admin users

Is there a way to remove the access of all users (or atleast multiple users) from workspace instead of removing access for each user one by one as below?Removing access of each user in this method is time consuming.

viji123_0-1659420683959.png

 

Is there any Power BI REST API command to remove the access of all users (or atleast multiple users) at one go?


Appreciate any response.
TIA!

1 ACCEPTED SOLUTION

Hi. I'm not sure how many users you have exactly but yes. You need to loop the users at workspaces. If you have a list of 500 that you are sure they shouldn't be at workspaces then yes. Loop the 500 removing them from workspaces. That's the only way to build the login in a script for now. The API won't allow batch delete of many users at the same time. 
This is why using office or azure AD groups is so important. If you have your company properly organized by groups you can just remove the group.

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

3 REPLIES 3
viji123
Frequent Visitor

Hi @ibarrau 
Thanks for your reply.
Do you suggest i have to programmatically call the DELETE API in a loop 500+ times to delete each user?
Kindly clarify

Hi. I'm not sure how many users you have exactly but yes. You need to loop the users at workspaces. If you have a list of 500 that you are sure they shouldn't be at workspaces then yes. Loop the 500 removing them from workspaces. That's the only way to build the login in a script for now. The API won't allow batch delete of many users at the same time. 
This is why using office or azure AD groups is so important. If you have your company properly organized by groups you can just remove the group.

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

ibarrau
Super User
Super User

Hi! the request from the API that you can use is the DELETE a user from GROUP. The thing is that you need to specify de workspace id and the user. So you might need to build a nice logic for your script. 

The following request is the one you can use: https://docs.microsoft.com/en-us/rest/api/power-bi/groups/delete-user-in-group

You can use PowerShell cmdlets or SimplePBI python lib if you want to keep the use of the API simpler.

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

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.

Top Solution Authors
Top Kudoed Authors