2
votes

I get an error when following step 7 (https://azure.microsoft.com/en-us/documentation/articles/power-bi-embedded-get-started-sample/) in the console app to update the connection strings for a direct query connection.

I tried to complete step 7 by providing the connection string to my db from azure and just replacing user name and password.

The error that the console app produces is a red message saying "Bad Request"

Without being able to complete this step 7, the web app with the embedded report produces the following error:

Couldn't load the data for this visual

Error CodeDMTS_DatasourceHasNoCredentialError

3
When you created the PBIX file in Power BI Desktop did you choose the "Import" or "Direct Query" option. In both cases they connect to your underlying data source, but only the "Direct Query" option will allow you to change the connection string / credentials after import.Wallace Breza
I just tried both Import and Direct Query option, when performing step 7 to uopdate the connection, both work with no problem, I am using Azure SQL for testing by the way. Thus, I don't think that option matters. I would suggest you set breakpoints and debug locally to get more information. The error "CodeDMTS_DatasourceHasNoCredentialError" indicates that there's no credential for the datasource.forester123

3 Answers

4
votes

Step 7 finally worked.

I understood step 7 after looking the following link that shows its code (line 500): https://github.com/Azure-Samples/power-bi-embedded-integrate-report-into-web-app/blob/master/ProvisionSample/Program.cs

Just to be clear, the "Username: " and "Password: " to provide on this step correspond to the Azure SQL credentials. I could skip the step: "Connection String (enter to skip): " given the connection was defined on the PBIX report uploaded. The report was using Direct Query. After completing step 7, the report is working on the web app.

1
votes

Just a small addition that will maybe to help someone. If you need to change also connection string, you should state it in following format:

Data Source=xxxx.database.windows.net;Initial Catalog=dbName;User ID=xxx;Password=xxx;

Credit goes to Nithya from PBI forum: https://community.powerbi.com/t5/Developer/PowerBI-Embedded-Sample-Connection-string/td-p/27454

0
votes

I had same issue today. The new CLI does not work to do step 7 right now. You get bad request. Go to GitHub and download an older version. I did that, allowed me to set connection string and it all started working.