PowerBI Embedded DMTS_DatasourceHasNoCredentialError - powerbi-embedded

I have create a PBIX file in PowerBI Desktop using DirectQuery method on Azure SQL Server. After that I uploaded the file to workspace. Now when I am opening that report on my custom web app using MVC API, it is throwing me following error:
Datasource has no credentials.
Please try again later or contact support and provide the following details to help resolve your issue faster.
Error CodeDMTS_DatasourceHasNoCredentialError
Server someserver.database.windows.net
Correlation ID3b3d08d7-21cd-7a4b-3778-79841050d3c4
ConnectionType {FieldValue}
Activity ID24480fac-d172-e3a6-17b6-eb8a2ce5b02c
Request IDb1ec1b45-5a65-c642-3fa0-4c5090102720
TimeFri Jun 10 2016 14:53:01 GMT+0500 (Pakistan Standard Time)
Version13.0.1500.198
Cluster URI https://wabi-south-east-asia-redirect.analysis.windows.net/

When you import your PBIX file into your Power BI workspace collection on Azure the service does not include your credentials due to security concerns. After your import is complete you can modify the credentials and / or connection strings using our REST APIs.
Power BI REST APIs
Specifically you'll need to call the PATCH datasource API
Patch Gateway Datasource API
Examples of calling these APIs via the SDKs can be found in the following:
.NET Provision Tool from sample (Update Connection)
Node JS Command Line tool (Update Connection)

Related

PowerBI Workspace cannot access Azure Synapse SQL Serverless Views

I am connecting to a SQL Serverless endpoint located in my Azure Synapse Account for my PowerBI Datasets. I am reading a SQL view that is composed of some parquet files in my data lake.
I am able to connect to the data fine when using PowerBI Desktop since it is using my Active Directory account. But now that I have the report published to a PowerBI Workspace online for other users in my organization I want to have it refresh the dataset daily without having to publish it myself.
Using the online refresh settings I am able to connect to SQL just fine using basic authentication (username/password) but it looks like when PowerBI renders the view it is also checking the credentials for the underlying datalake data which it does not have access to:
Microsoft SQL: Cannot find the CREDENTIAL 'https://mydatalake.dfs.core.windows.net/parquet/**', because it does not exist or you do not have permission. Could not use view or function 'dbo.MyView' because of binding errors.
What is the best way for me to give my PowerBI Workspace permissions to read this view (along with underlying datalake files)?
I'm also puzzled that in PowerBI Workspace I had options to schedule this data set but after a few failed attempts it now states:
You can't schedule refresh for this dataset because the following data sources currently don't support refresh:
And there is nothing after the ":" so now it appears I cannot attempt to connect anymore.
I have the PowerBI Workspace set as a linked service but that does not seem to help since I believe that is only for Synapse to use to connect to the workspace and not the other way.
I was toying with the idea of having Synapse copy the view data to a SQL database outside of Synapse so it can be shared more easily - but my preference would be to avoid this extra layer.

Power BI Report Server Embedding & Silent Authentication

I am trying to silently authenticate the embeded report like done in Power BI Service. However in Report Server embedding is available through iframe and user is prompted to login with Windows/NTLM account. How can I authenticate silently like done in cloud based approach with a master user ?
So here is how I solved this issue for anyone wondering.
I wrote a reverse proxy to Power BI Reporting Server in my .Net Core application and authenticated each request with BASIC. I needed to enable BASIC authentication and CORS from application URL. (also you may need to add Network Service as content manager/viewer to your report)
Here are some useful links:
Proxy
PBIRS CORS

How to call the Power BI Activity Log API

I would like to call the Power BI Activity Log API with data factory each day to download the activity events into a blob store. I thought I'd use a Copy data activity with an HTTP dataset as source to call the REST API. How do I authenticate in the HTTP dataset's linked service? Do I need to register an Azure AD application with Power BI admin rights and refer to it in some way in the linked service?
Maybe you can have a look at Service Principals, it can help you to easily authenticate and access Power BI admin read-only APIs (ActivityEvents API included) without tying you to a particular user account. Its in preview feature as of today, but should be soon out of preview.
Also, for automating the fetching of logs using Azure Data Factory and ingesting it in Azure Blob, you may have a look at this great article which explains in detail, all the steps that will be required to create the pipeline. Should be helpful!

Connect Web API as a data source to power bi using authentication

I have azure web api app with number of web apis of type post/get to get data. these apis are having basic authentication (bearer token)
I want to use 2-3 APIs as a data source in power bi, so that I can use these APIs JSON response as a table.
In Power BI Desttop > Get Data > Web > add API URL with sample GET API method name, will work but then it is asking for authentication.
If I tried to put API Key, then it is saying: A web API key can only be specified when a web API key name is provided.
How to connect web api using authentication in power bi as a data source.
PowerBI web seems to currently have little or no support for connecting to data via webapi, or web queries generally.
PowerBI Desktop allows you to get data from the web. I have been able to access data from webapis managed by Azure API Management in two different ways:
Use Advanced rather than Basic in the From Web dialog box. Put the webapi query in the url, but add a header with name Ocp-Apim-Subscription-Key and put in as value the value of the api key.
Alternatively, instead of putting the api key in the header, with APIs managed by Azure API management, it seems you can add them to as a parameter to the apiquery, subscription-key=PutYourApiKey here.
However, I have found that although you can publish your data source or report to an online workspace, PowerBI online will give an error ("credentials not recognized" or similar) when you try and refresh the data! So as mentioned above, PowerBI online seems currently (Nov 2020) useless for connecting to WebApi data.

Error when trying to configure Power BI Data Gatwewy

Just installed Power BI Data Gateway on one of the companies servers.
The processes was smooth and very easy, I have assigned a name to the Data Gateway.
As it is linked to my email (I think this is going to be another problem when other employees trying to publish their reports), when I tried to configure datasource in my Gateway I get this error !
Unable to connect: We encountered an error while trying to connect to . Details: ""
Activity ID: 951737c3-eea2-43c3-b5d4-7bb03e247e5b
Request ID: b7c69cff-2be9-f965-2586-14b978802dd7
Cluster URI: https://wabi-australia-southeast-redirect.analysis.windows.net
Status code: 400
Error Code: DMTS_UpdateClusterDatasourceCredentialsErrorCode
Time: Mon Sep 02 2019 10:15:31 GMT+1000 (AUS Eastern Standard Time)
Version: 13.0.10599.151
PBIGateway: The on-premises data gateway's service account failed to impersonate the user.
I am sure that my user ID and password are both correct, not sure why it is not working!!
This one had me stumped for days. Why would the PBI desktop app allow connections, seamlessly on your desktop and yet when you publish a report to the web, bong-bong no authentication, no credentials, nothing! It was very frustrating, and no specific details other than a plethora of connection IDs which mean nothing.
In the end, we found the problem was between how we've set up the Power BI Gateway on-prem, and whether the gateway service account on the gateway had the permissions to access our data sources, both from SQL Server on-prem and an Excel table in Sharepoint.
When setting up your Gateway (not a personal GW, but a server side one), we've created the gateway using the Admin local account. That was our first mistake. We couldn't connect to any of our SQL Server databases, from Sharepoint. So we've re-installed it using an Admin O365 AD account. Our SQL Server access was ok, but anything in Sharepoint wouldn't work - even though the same account was used to put Excel files and CSV files into Sharepoint.
We then noticed that the gateway was defaulted to a service account under the NT Authority group. Again, another local account. Changed that to another O365 account, but again - nothing would allow us to connect to the Excel sharepoint file! How hard can this be, when the Excel file connected fine inside PowerBI desktop! It was very frustrating.
So we've re-installed the on-prem gateway again, but this time used one AD account for it's sign on, and another system AD account for it's service account. We also publish the PBI report to the cloud, but the dataset would be failing to connect to the Excel file in Sharepoint. WHY!!!???
It came to that User tab and putting our on-prem gateway service account in the User list of the connector to the Sharepoint file.
VOILA!! It worked.
In summary:
Create your PBI reports in desktop and point everything you need to what ever you need in the Get Data wizards
If you're referring to an Excel file, DO NOT point to a local / network Excel file. You're wasting your time.
Put the Excel/CSV or whatever in sharepoint in a Documents folder somewhere
Click Manage Permissions on the file and add the On-Prem service gateway to the list
Next, open the Excel file on the web
And go ahead and open it in your local desktop Excel as well
Go to FILE --> INFO
Click Copy Location to store the location of the file in the clipboard. Save this string in notepad
Close Excel on-prem
Close Excel online
Go to your PBI report and edit the M-Code via the Advanced Editor of your data source
Replace the C drive location of your Excel filepath with the one copied into your notepad
Now your query is pointing to the Excel file in sharepoint.
Publish your report
Go to app.powerbi.com and go to your report's dataset
Click the three dots and go to Settings
Go to Gateway Cluster and lick Manage Gateway link
Open up your gateway cluster and go to your Excel data connector
Select it and click the Users tab
Add your on-prem gateway service account again to this list
Save
Refresh your dataset
Voila! No more errors.
I hope this lengthy answer has been enough for your to realise [1] microsoft write great software, but crappy user-experience with it and [2] you need to pass on the credentials of the gateway to any datasource that uses it, in reference to any datasource that require a gateway between on-prem and cloud reports.
We have same problem in powerbi gateway. Turns out the database password is expired. After reset password. Problem solved.