cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
chris-h Regular Visitor
Regular Visitor

Update report content using rest api returns Unauthorized

I'm trying to create a functioning CI/CD setup. Using UpdateReportContent I want to update the Production report with the Test report.

I'm calling the REST API using the Service Principal and it all works fine for other stuff, i.e. getting reports, uploading pbix files.

The SP has admin rights to both Test and Production workspace. The Service Principal also have the correct permissions (Report.ReadWrite.All) registered in the App Registration in Azure AD.

I've tried this using Postman and by calling the REST API with Powershell, both with the same 401 Unauthorized result. 

 

However when I use the "playground / try it" here signing in with my own personal account (which also have admin rights) i can update the report. The request body I used is the same as the one from postman, therefore verifying that my json body is correct.

 

Anyone who have been able to update the report using the REST api with Service Principal ?

 

Response: 

{"error":{

"code":"PowerBINotAuthorizedException",

"pbi.error":{

"code":"PowerBINotAuthorizedException",

"parameters":{},

"details":[],

"exceptionCulprit":1

}}}

1 ACCEPTED SOLUTION

Accepted Solutions
chris-h Regular Visitor
Regular Visitor

Re: Update report content using rest api returns Unauthorized

Update: I found that Clone (https://docs.microsoft.com/en-us/rest/api/power-bi/reports/clonereportingroup) report works over different workspaces so I decided to go with that solution. 

One problem with it is that it does not replace a report if there's a name conflict, and I can't choose to specify a report id to replace. So what I did was to get reports (https://docs.microsoft.com/en-us/rest/api/power-bi/reports/getreportsingroup) and extract the one with matching name and do a delete (https://docs.microsoft.com/en-us/rest/api/power-bi/reports/deletereportingroup) on that report. 

Then I clone the report I want moved by specifing the dataset I want to use in the other workspace.

View solution in original post

2 REPLIES 2
chris-h Regular Visitor
Regular Visitor

Re: Update report content using rest api returns Unauthorized

It works when the reports are in the same workspace, just tried it by calling the rest api with powershell. 

 

Is this a limitation with Service Principal ? That you can't Update report content with reports from different workspaces

chris-h Regular Visitor
Regular Visitor

Re: Update report content using rest api returns Unauthorized

Update: I found that Clone (https://docs.microsoft.com/en-us/rest/api/power-bi/reports/clonereportingroup) report works over different workspaces so I decided to go with that solution. 

One problem with it is that it does not replace a report if there's a name conflict, and I can't choose to specify a report id to replace. So what I did was to get reports (https://docs.microsoft.com/en-us/rest/api/power-bi/reports/getreportsingroup) and extract the one with matching name and do a delete (https://docs.microsoft.com/en-us/rest/api/power-bi/reports/deletereportingroup) on that report. 

Then I clone the report I want moved by specifing the dataset I want to use in the other workspace.

View solution in original post

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)