New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export-PowerBIReport Is not working as admin #65

Open
Weatwagon opened this Issue Aug 9, 2018 · 4 comments

Comments

Projects
None yet
5 participants
@Weatwagon
Copy link

Weatwagon commented Aug 9, 2018

I'm running Export-PowerBIReport as global admin and I'm receiving an 'Unauthorized' error (full error below) for reports in workspaces I am not assigned or other user's personal workspaces. I can list all the reports in all the personal workspaces of other people though. We are in the middle of the transition process to GCC from the public tenant, it would be nice to export all of our user's content from the public tenant before we lose access.

RequestId : cc691c42-e5fa-4919-976f-846d8a1acf7c
Response : Unauthorized (401): {"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}}
PowerBIErrorInfo :
ResponseDate : Thu, 09 Aug 2018 07:13:34 GMT
RequestMethod : GET
RequestUri : https://api.powerbi.com/v1.0/myorg/reports/46590729-0131-46a5-b702-bde21ed9033e/Export
InvocationInfo : {Export-PowerBIReport}
Line : Get-PowerBIReport -WorkspaceId 'df5e1412-b279-4955-988e-6917af3d02ac' -Scope Organization | %{Export-PowerBIReport -Id $.id -OutFile D:\ner.pbix }
Position : At line:1 char:96
+ ... rganization | %{Export-PowerBIReport -Id $
.id -OutFile D:\ner.pbix }
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
StackTrace : at Microsoft.PowerBI.Api.V2.Reports.d__9.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.d__29.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 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 : 173

@hongju

This comment has been minimized.

Copy link

hongju commented Aug 17, 2018

I got error too.
Export-PowerBIReport : Operation returned an invalid status code 'Unauthorized'

@mthierba

This comment has been minimized.

Copy link

mthierba commented Aug 26, 2018

@Weatwagon The Export Report operation is not one of the new Admin operations, hence whilst you can enumerate all reports in your workspace as a global admin, you can only export them as a user that has explicit access to all the workspaces and with an access token for the Report.ReadWrite.All or Report.Read.All scopes (these are set in your AAD application).

@CodeCyclone

This comment has been minimized.

Copy link
Collaborator

CodeCyclone commented Nov 27, 2018

That is correct, we are considering creating an export for admin operation for the API but currently it only works when the calling user is assigned to the workspace.

@sqlchick

This comment has been minimized.

Copy link

sqlchick commented Nov 27, 2018

Thanks for clarifying on the difference between the Export- cmdlet from the other Admin operations. Very helpful! Initially I was thinking that being able to reach into other users 'My Workspace' to back up content would be useful (particularly if we discover users are delivering important content via sharing from their workspace vs. utilizing an app workspace). Upon reflection, that would make a Power BI Admin suddenly have very far-reaching permissions, and the ability to see all data across the org, so I can see the need for a separate role that allows such elevated permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment