The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I need to get the list of Power BI reports for which the refresh was failed.
I could get the status of all refreshed reports with Successful, Failed and disabled status using the below script.
I need to filter only 'Failed' reports. Is that possible?
Thank you!
Connect-PowerBIServiceAccount $Workspaces = Get-PowerBIWorkspace foreach($workspace in $Workspaces) { $DataSets = Get-PowerBIDataset -WorkspaceId $workspace.Id | where {$_.isRefreshable -eq $true} foreach($dataset in $DataSets) { $URI = "groups/" + $workspace.id + "/datasets/" + $dataset.id + "/refreshes" #$OutFile = $ExportFolder + '\' + $workspace.Name + '-' + $dataset.Name + '.json' $Results = Invoke-PowerBIRestMethod -Url $URI -Method Get | ConvertFrom-Json foreach($result in $Results.value) { $errorDetails = $result.serviceExceptionJson | ConvertFrom-Json -ErrorAction SilentlyContinue $row = New-Object psobject $row | Add-Member -Name "Workspace" -Value $workspace.Name -MemberType NoteProperty $row | Add-Member -Name "Dataset" -Value $dataset.Name -MemberType NoteProperty $row | Add-Member -Name "refreshType" -Value $result.refreshType -MemberType NoteProperty $row | Add-Member -Name "startTime" -Value $result.startTime -MemberType NoteProperty $row | Add-Member -Name "endTime" -Value $result.endTime -MemberType NoteProperty $row | Add-Member -Name "status" -Value $result.status -MemberType NoteProperty $row | Add-Member -Name "errorCode" -Value $errorDetails.errorCode -MemberType NoteProperty $row | Add-Member -Name "errorDescription" -Value $errorDetails.errorDescription -MemberType NoteProperty Write-Host $row }}}
Thank you,
Poonam
Solved! Go to Solution.
Hi @patilpoonam21 ,
Based on the description, try to modify the foreach result script to the following script.
foreach($result in $Results.value)
{
if($result.status -eq "Failed")
{
$errorDetails = $result.serviceExceptionJson | ConvertFrom-Json -ErrorAction SilentlyContinue
$row = New-Object psobject
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @patilpoonam21 ,
Based on the description, try to modify the foreach result script to the following script.
foreach($result in $Results.value)
{
if($result.status -eq "Failed")
{
$errorDetails = $result.serviceExceptionJson | ConvertFrom-Json -ErrorAction SilentlyContinue
$row = New-Object psobject
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
141 | |
116 | |
110 | |
65 | |
54 |
User | Count |
---|---|
245 | |
116 | |
103 | |
96 | |
92 |