Forum Discussion
Export Reports to File Using SPN Access?
- 6 years ago
Looking around some articles, I believe that the issue might be related to this workspace not working at Premium capacity --> https://powerbi.microsoft.com/en-us/blog/announcing-support-for-service-principals-using-the-xmla-endpoint-in-power-bi-premium/. The lowest-tier Power BI Premium license would be around $3K/month, so I'm unsure if I will get this project off the ground if that's all the case.
So I followed the advice of adding the identity specs to my export request, as was described here --> https://community.powerbi.com/t5/Developer/Rest-API-Export-Report-to-PDF-that-uses-Azure-Analysis-Service/m-p/1133666#M23967.
Same result (see below). This service principal has full access granted to the Power BI workspace. So I'm at a loss. 😞
POST https://api.powerbi.com/v1.0/myorg/groups/{group_id}/reports/{report_id}/ExportTo HTTP/1.1
Host: api.powerbi.com
Authorization: Bearer {access_token}
User-Agent: FxVersion/4.700.19.60701 OSName/Windows OSVersion/Microsoft.Windows.6.1.7601.Service.Pack.1 Microsoft.PowerBI.Api.PowerBIClient/3.11.1.20103
Content-Type: application/json; charset=utf-8
Content-Length: 638
{
"format": "PDF",
"powerBIReportConfiguration": {
"settings": {
"locale": "en-us"
},
"pages": [
{
"pageName": "ReportSectionbe63eaf77c6775278e11"
}
],
"identities": [
{
"username": "{spn_object_id}",
"datasets": [
"{dataset_id}"
],
"roles": [
"client"
]
}
]
},
"paginatedReportConfiguration": {
"formatSettings": {
"PageHeight": "14in",
"PageWidth": "8.5in",
"StartPage": "1",
"EndPage": "4"
}
}
}
HTTP/1.1 401 Unauthorized
Content-Length: 153
Content-Type: application/json; charset=utf-8
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: deny
X-Content-Type-Options: nosniff
Access-Control-Expose-Headers: RequestId
request-redirected: true
home-cluster-uri: https://wabi-us-central-a-primary-redirect.analysis.windows.net/
RequestId: 6937aa84-e2e1-4cda-a7fe-53c9e28f52a8
Date: Thu, 11 Jun 2020 17:56:19 GMT
{"error":{"code":"PowerBINotAuthorizedException","pbi.error":{"code":"PowerBINotAuthorizedException","parameters":{},"details":[],"exceptionCulprit":1}}}
Any feedback on this question? I was hoping it was something simple I was overlooking somehow...
- gregarican6 years agoFrequent Visitor
Bumping this again. No one has run into anything similar?