Forum Discussion
[Powershell] Get workspaces for specified group of users
- 4 years ago
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:
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" -NoTypeInformationBest Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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:
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.