Forum Discussion
401 error code only when trying to Export a report
- 5 years ago
Soution: I was using the endpoint: https://api.powerbi.com/v1.0/myorg/reports/<report_id>/Export
That endpoint works perfectly with the master password, becuase it refers to my workspace.
But when using a service principal, you don't have a "My workspace" to export from.
If the endpoint used change to 'https://api.powerbi.com/v1.0/myorg/groups/<group_id>/reports' then there is no 401 error anymore.
Soution: I was using the endpoint: https://api.powerbi.com/v1.0/myorg/reports/<report_id>/Export
That endpoint works perfectly with the master password, becuase it refers to my workspace.
But when using a service principal, you don't have a "My workspace" to export from.
If the endpoint used change to 'https://api.powerbi.com/v1.0/myorg/groups/<group_id>/reports' then there is no 401 error anymore.