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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Dhruvin27
New Member

Power BI PowerShell - A task was canceled.,Microsoft.PowerBI.Commands.Reports.GetPowerBIReport

I have 1500+ Workspaces in my Power BI Tenant. When I loop through the Workspaces and try to Get Reports using the following code snippet, it is working for few workspaces. Around (30 Workspace).

 

 

$report = Get-PowerBIReport -Scope Organization -WorkspaceId $WS.Id 

 

 

After that it started propmpting the following error!

 

+ CategoryInfo : WriteError: (Microsoft.Power...etPowerBIReport:GetPowerBIRep
ort) [Get-PowerBIReport], TaskCanceledException
+ FullyQualifiedErrorId : A task was canceled.,Microsoft.PowerBI.Commands.Reports.GetP
owerBIReport

 

 

Then, any script execution is failing. Is there any Limit to call PowerShell command ? Is there any Timeout Problem with Power BI PowerShell? Any solution for this problem? 

 

2 REPLIES 2
AndreaQ
New Member

You can integrate request with this script. Timeout seconds are in $timesleep. just looping it ...
i use for 
Add-PowerBIWorkspaceUser
 don't forget if statement
$apiTraceback = Resolve-PowerBIError -Last 
$text = $apiTraceback.Response
[regex]$usernameReg = "(\d\d\d\d)"
$timesleep= $usernameReg.Match($text).Value
Start-Sleep -s $timesleep

 

lbendlin
Super User
Super User

Use Invoke-RestMethod with this API call

Admin - Groups GetGroupsAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Docs

It supports filtering and pagination, and generally has better performance.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.