TLDR: There is a bug in the Power BI REST API that requires the connection string to be in a specific format.

Recently, I developed an Azure DevOps release pipeline for a project that included publishing paginated Power BI reports (often referred to as simply 'RDL reports'). Using the Power BI REST API, this was simple enough. However, I ran into an issue when it came to the step of setting the data source credentials.

In order to set basic credentials, I was calling the update datasource operation. Initially, everything seemed to work well - the api was returning '200 OK' and the pipeline was green. Unfortunately, it soon became clear that the report was actually running using pass-through credentials. Since these reports were designed to leverage Synapse resource classes, I needed to get basic credentials working.

A ticket with Microsoft was opened which lead to some dead ends and a few days of silence as the product group reviewed my fiddler traces.

I decided to create a RDL report from scratch using Power BI Report Builder that simply printed the SYSTEM_USER. I then used the update datasource operation to set basic credentials and to my surprise it worked first try. Now that I had a working report and a non-working report, I was able to compare them to determine why one worked and the other didn't. Fortunately, RDL reports are plain xml, so it was easy enough to diff the two files. After a bit of investigation and testing, I found the culprit to be the connection string format.

highlighting ConnectString differences

I sent my findings along to Microsoft, who in turn acknowledged a parsing bug in the api.

I think this might happen more often when migrating reports from SSRS, as I believe the old report builder used the 'Data Source=' format.

In conclusion, ensuring your connection string is in the following format will allow for setting RDL report credentials via the Power BI REST API.

Server=mine.database.windows.net,1433;Initial Catalog=db;

If you'd like to test for yourself on your own Power BI instance, I've provided the test reports here:

WhichUserBad.rdl
WhichUserGood.rdl