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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

[Powershell] Get workspaces for specified group of users

Hello,

 

I am looking for some solution that allows me to find all workspaces where a specified group of users has access. So first, I prepare the list of such users in the variable, and then I would like to search by iterating workspaces to find if they have access. Here is the example list of my users:

 

$Users = Get-AzureADUser -all $true | Where-Object {$_.Department -like "*XYZ*"}

 

 

How would you find all workspaces where they have access?

Thank you very much for any help!

Regards

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

As far as I am concerned,You can get a list of users who have access to the App Workspace, but you will not be able to find users who have access via Workspace.

You can use the following Power BI REST API to find out details in Workspaces then loop through all your app workspaces to find the details:

https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.workspaces/get-powerbiworkspace?view=powerbi-ps 

Hope this sample script may help you:

Login-PowerBIServiceAccount
Get-PowerBIWorkspace -Scope Organization -All |
ForEach-Object {
$Workspace = $_.name
$WorkspaceId = $_.Id
$IsOnDedicatedCapacity = $_.isOnDedicatedCapacity
$State = $_.state
$Type = $_.type
$Capacityid = $_.CapacityId
foreach ($User in $_.Users) {
[PSCustomObject]@{
Workspace = $Workspace
WorkspaceId = $WorkspaceId
IsOnDedicatedCapacity = $IsOnDedicatedCapacity
State = $State
Type = $Type
CapcityId = $Capacityid
User = $User.accessright
Identifier =$user.Identifier}
}} | Export-CSV "C:\xxxxx\Workspace-UserAccess.csv" -NoTypeInformation

 

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

View solution in original post

2 REPLIES 2
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

As far as I am concerned,You can get a list of users who have access to the App Workspace, but you will not be able to find users who have access via Workspace.

You can use the following Power BI REST API to find out details in Workspaces then loop through all your app workspaces to find the details:

https://docs.microsoft.com/en-us/powershell/module/microsoftpowerbimgmt.workspaces/get-powerbiworkspace?view=powerbi-ps 

Hope this sample script may help you:

Login-PowerBIServiceAccount
Get-PowerBIWorkspace -Scope Organization -All |
ForEach-Object {
$Workspace = $_.name
$WorkspaceId = $_.Id
$IsOnDedicatedCapacity = $_.isOnDedicatedCapacity
$State = $_.state
$Type = $_.type
$Capacityid = $_.CapacityId
foreach ($User in $_.Users) {
[PSCustomObject]@{
Workspace = $Workspace
WorkspaceId = $WorkspaceId
IsOnDedicatedCapacity = $IsOnDedicatedCapacity
State = $State
Type = $Type
CapcityId = $Capacityid
User = $User.accessright
Identifier =$user.Identifier}
}} | Export-CSV "C:\xxxxx\Workspace-UserAccess.csv" -NoTypeInformation

 

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

lbendlin
Super User
Super User

Might be easier to ask your tenant admin for the respective inventory logs (WorkspacesUsers).

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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