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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Working with Get-PowerBIDashboard cmdlets to collect Dashboard ID based on Workspace ID

Hello Power BI community,

I am having some troubles while trying to collect all PowerBI dashboard GUID by Workspace ID using Get-PowerBIDashboard cmdlet. I should be able to get the result I want by running Get-PowerBIDashboard -Scope Organization -WorkspaceId <Workspace GUID>, however, when I run this, the cmdlet will take a while to process and eventually throw me an error as presented below:

---

Get-PowerBIDashboard : A task was canceled.
At line:1 char:1
+ Get-PowerBIDashboard -Scope Organization -WorkspaceId $Object ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...owerBIDashboard:GetPowerBIDashboard) [Get-PowerBIDashboard], TaskCanceledException
+ FullyQualifiedErrorId : A task was canceled.,Microsoft.PowerBI.Commands.Reports.GetPowerBIDashboard

---

The interesting part about this is whenever I run this cmdlet without -WorkspaceId parameter,  Get-PowerBIDashboard -Scope Organization, I am able to get all dashboard GUID with all its properties. But in my case, the missing -WorkspaceId parameter is needed because I NEED Workspace ID to accomplish my task so that I can build a PowerBI report that uses Workspace ID as reference to form relationship between reports table & dashboard table. 

Another interesting part about this is that this command, Get-PowerBIDashboard -Scope Organization -WorkspaceId <Workspace GUID>, does work sometime where it successfully collect all of the dashboard GUID based on calling -WorkspaceId parameter, and I have no idea why. The problem here is that I need this command to work consistently as this command is being run as a scheduled job in one of the servers. 

Therefore, I would like to know if anyone here can help me to identify this issue and get it resolve. Any suggestions or workaround to collect the Dashboard's Workspace ID based on Dashboard ID will also be truly appreciated. Thanks in advance.

---

I have tried GET https://api.powerbi.com/v1.0/myorg/groups/{groupId}/dashboards but receive an error.

Code is presented below:

## Get Power BI Workspaces
$Workspaces = Get-PowerBIWorkspace -Scope Organization -All
$DashboardsArray = @() ## to collect dashboard object

foreach ($Workspace in $Workspaces)
{
    if ($Workspace.State -eq "Active")
    {
        ## Get Dashboard objects
        $Dashboards = Get-PowerBIDashboard -Scope Organization -WorkspaceId $Workspace.Id

        foreach($Dashboard in $Dashboards)
        {
            $NewDashboardObject = New-Object System.Object
            $NewDashboardObject | Add-Member -MemberType NoteProperty -Name "WorkspaceID" -Value $Workspace.Id #Add the workspace ID that this dashboard belongs to
            $NewDashboardObject | Add-Member -MemberType NoteProperty -Name "DashboardID" -Value $Dashboard.Id
            $NewDashboardObject | Add-Member -MemberType NoteProperty -Name "Name" -Value $Dashboard.Name
            $NewDashboardObject | Add-Member -MemberType NoteProperty -Name "IsReadOnly" -Value $Dashboard.IsReadOnly
            $DashboardsArray += $NewDashboardObject
        }
    }
}

 

Status: Investigating

Hi @JChai 

Based on the above information, if you are a Power BI Pro licensee, you can create a support ticket for free and a dedicated Microsoft engineer will come to solve the problem for you.

It would be great if you continue to share in this issue to help others with similar problems after you know the root cause or solution.

The link of Power BI Support: https://powerbi.microsoft.com/en-us/support/

For how to create a support ticket, please refer to https://community.powerbi.com/t5/Community-Blog/How-to-create-a-support-ticket-in-Power-BI/ba-p/6830...

 

Best Regards,
Community Support Team _ Ailsa Tao

Comments
v-yetao1-msft
Community Support
Status changed to: Needs Info

Hi @JChai 

Did you try this command in Rest API pane ? I tested it and returned the correct results .

Ailsamsft_0-1670574737867.png

Best Regards,
Community Support Team _ Ailsa Tao

JChai
Advocate I

Hello @v-yetao1-msft ,

Yes, I did that and that works perfectly fine for those that I have workspace access and those that doesn't return 401 ERROR. If I do Get-PowerBIDashboard -Scope Organization, I will get all dashboards including those that I do not have access to, however, I need to collect the meta-info based on workspace Id so that each dashboard id has its associated workspace Id. This Id help in visualizing both dashboard and datasets meta-info on Power BI by using workspace Id as the key to reference between tables. I am guessing that when using -Scope Organization there is an API limitation on how many requests can be send per specified period. But, I need to monitor more than 2000 workspaces, therefore, I need a way to collect all dashboards, reports, dataflow, datasets, etc meta-info based on workspace Id. Thanks.

v-yetao1-msft
Community Support
Status changed to: Investigating

Hi @JChai 

Based on the above information, if you are a Power BI Pro licensee, you can create a support ticket for free and a dedicated Microsoft engineer will come to solve the problem for you.

It would be great if you continue to share in this issue to help others with similar problems after you know the root cause or solution.

The link of Power BI Support: https://powerbi.microsoft.com/en-us/support/

For how to create a support ticket, please refer to https://community.powerbi.com/t5/Community-Blog/How-to-create-a-support-ticket-in-Power-BI/ba-p/6830...

 

Best Regards,
Community Support Team _ Ailsa Tao