Dreale20
Dreale20

Reputation: 31

PowerBi List of all workspaces and users within - Newbie Question

My job entails me rotating through different parts of our IT Team. I recently moved to our Analytics department and found myself utilizing Powershell to retrieve data for Power BI. Bear with me here as I am new to this...

My goal is to generate a list of all the workspaces in our organization and the users correlated with each workspace. In general we want to try to get a wider-view on what is taking place within our tenant.

I've tried each of these methods with no success.

https://powershell.org/forums/topic/powerbi-query-trying-to-list-workspaces-and-users/

How to extract all PowerBI users and workspace access using the PowerBI API or Azure Portal?

Ive also tried to run the command below but get the error of "System.Linq.Enumerable+WhereSelectListIterator`2" when it should be the user info.

Get-PowerBIWorkspace -Scope Organization -Include All -All |select-object | export-csv c:\temp\powerbiworkspaces.csv -NoTypeInformation

Any help would be greatly appreciated..

Thank you in advance,

Upvotes: 0

Views: 8347

Answers (1)

Dreale20
Dreale20

Reputation: 31

After struggling a bit I ended up re-purposing the code from the one link. This worked for me therefore ill leave this up.

#Gets User, workspace, workspaceId 
Get-PowerBIWorkspace -Scope Organization -Include All -All  | 
ForEach-Object {
$Workspace = $_.name
$WorkspaceId = $_.Id
foreach ($User in $_.Users) {
[PSCustomObject]@{
Workspace = $Workspace
WorkspaceId = $WorkspaceId
User = $User.accessright    
Identifier   =$user.Identifier}}} | Export-CSV "C:\Temp\WorkspaceDetails.csv" -NoTypeInformation

Upvotes: 3

Related Questions