Forum Discussion

tedbuny's avatar
tedbuny
Frequent Visitor
1 year ago
Solved

Create a PBI report to View All Objects

Is it possible to create a PBI report that will list all workspaces, dashboards, reports, etc.. I guess it's an inventory of all the objects. We're finding duplicate reports scattered thoughout multiple workspaces. Not one or two but hundreds. Thanks!

  • tedbuny Yes, you use Powershell to use the Power BI API. Here is a video on how to get all the workspaces for example. The description for the video has the powershell code you need.

    Here are the Powershell commands:
    
    Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser -Force
    Import-Module MicrosoftPowerBIMgmt
    Connect-PowerBIServiceAccount
    #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
    
    Script was found here: https://stackoverflow.com/questions/60304354/powerbi-list-of-all-workspaces-and-users-within-newbie-question

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    tedbuny Yes, you use Powershell to use the Power BI API. Here is a video on how to get all the workspaces for example. The description for the video has the powershell code you need.

    Here are the Powershell commands:
    
    Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser -Force
    Import-Module MicrosoftPowerBIMgmt
    Connect-PowerBIServiceAccount
    #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
    
    Script was found here: https://stackoverflow.com/questions/60304354/powerbi-list-of-all-workspaces-and-users-within-newbie-question