Forum Discussion
Export reports as admin
Hi, I am trying to export all reports we have using rest api. I have admin rights, so i am using
https://api.powerbi.com/v1.0/myorg/admin/groups?$top={$top}and
https://api.powerbi.com/v1.0/myorg/admin/groups/{groupId}/reports
When i try to export all of these, using
https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/ExportI get unauthorized on most of them.
Is there a possibility to get authorization for exporting all the reports or any other way how to export all of them?
thanks
2 Replies
- AnonymousNot applicable
Anonymous
Before using the API, make sure the following are enable in tenant setting. Please check this doc: https://docs.microsoft.com/en-us/power-bi/developer/embedded/export-to
- Export reports as PowerPoint presentations or PDF documents - Enabled by default.
- Export reports as image files - Required only for .png and disabled by default.
Regarding the authorization, it is difficult for me to reproduce that issue and test on it. You can try service principle authorization with Azure ad. Please Refer: https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal
Paul Zheng _ Community Support Team
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- LucasLabsNew Member
Hi Paul, we have done the following as listed above. But the export from users personal workspace does not work as admin. This should be available as to allow firms to check whether a Cyber Security Policy is being breached by a employee or contractor.
consider the following
BI Admin identifies a user has exported some data and is sharing is externally rather than disable all users from external sharing the Cyber Security Team have asked him/her to check if ther user has breached company policy. The POwer Bi Admin must check download a pbix file from the a personal workspace of any employee.
Current the command below produces
https://api.powerbi.com/v1.0/myorg/groups/{groupId}/reports/{reportId}/ExportIt give the following error?
RequestId : 12700bd9-383d-44e9-a25a-8bc6cd2af3c0
Response : Unauthorized (401):
PowerBIErrorInfo : GroupNotAccessible
ResponseDate : Mon, 14 Jun 2021 04:41:07 GMT
RequestMethod : GET
RequestUri : https://api.powerbi.com/v1.0/myorg/groups/3c7066a4-a67e-4aaa-bd2e-b11dd2356aa8/reports/6815b18b-1f3c-4a3d-8682-7a4aa098b93b/Export
InvocationInfo : {Export-PowerBIReport}
Line : Export-PowerBIReport -WorkspaceId 3c7066a4-a67e-4aaa-bd2e-b11dd2356aa8 -Id 6815b18b-1f3c-4a3d-8682-7a4aa098b93b -OutFile C:\temp\test.pbix
Position : At line:1 char:1
+ Export-PowerBIReport -WorkspaceId 3c7066a4-a67e-4aaa-bd2e-b11dd2356aa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace : at Microsoft.PowerBI.Api.V2.Reports.<ExportReportInGroupWithHttpMessagesAsync>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Api.V2.ReportsExtensions.<ExportReportAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.Api.V2.ReportsExtensions.ExportReport(IReports operations, String groupId, String reportKey)
at Microsoft.PowerBI.Common.Api.Reports.ReportsClient.ExportReport(Guid reportId, Nullable`1 workspaceId)
at Microsoft.PowerBI.Commands.Reports.ExportPowerBIReport.ExecuteCmdlet()
at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord()
HistoryId : 37