cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jeremyg
Frequent Visitor

Powershell PowerBIMgmt - WriteError

Hi, 

In PowerShell, using the Microsoft.PowerBi.Management Cmdlet API,
https://docs.microsoft.com/en-us/powershell/power-bi/overview?view=powerbi-ps

When i want export Report with command Export-PowerBIReport ,
something went wrong and said status code 404 'not found'.
- Report Id is good. 
- Path OutFile is working with other command. 

PS> Export-PowerBIReport -Id b0f8c75d-24b2-4eb3-f0b0-19bc4f3cd7e6 -OutFile C:\Temp\Production.pbix
Export-PowerBIReport : Operation returned an invalid status code 'NotFound'At line:8 char:5
+ Export-PowerBIReport -Id $space.Id -OutFile $name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...rtPowerBIReport:ExportPowerBIReport) [Export-PowerBIReport], HttpOperationException
+ FullyQualifiedErrorId : Operation returned an invalid status code 'NotFound',Microsoft.PowerBI.Commands.Reports.ExportPowerBIReport

4 REPLIES 4
Community Support
Community Support

Re: Powershell PowerBIMgmt - WriteError

Hi @jeremyg ,

Is there anything special on your report? If you test on service side, can you find export option on that report?
In addition, did this issue only appears when you use current id and path?

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
jeremyg
Frequent Visitor

Re: Powershell PowerBIMgmt - WriteError

Yes, I can export the report from Powerbi service, we are looking for backup automotion,
and no issue with path, this work with other commands.

jeremyg
Frequent Visitor

Re: Powershell PowerBIMgmt - WriteError

Connect-PowerBIServiceAccount
Get-PowerBIDatasource -DatasetId c972ee60-37c9-b446-846f-9b4224166e3e

Return same error,
but bypassed below with commands REST API, i get results

 

Connect-PowerBIServiceAccount
$headers = Get-PowerBIAccessToken
$Uri = 'https://api.powerbi.com/v1.0/myorg/groups/ --- [WORKSPACE ID] --- /datasets/c972ee60-37c9-b446-846f-9b4224166e3e/datasources'
Invoke-RestMethod -Headers $headers -Uri $Uri

 

Highlighted
Community Support
Community Support

Re: Powershell PowerBIMgmt - WriteError

Hi @jeremyg ,

If you use fiddler to trace powershell request, can you trace some details error message about that request? 
In addition, you can also post to develop forum to get better support.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors