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.