Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
volma
New Member

Can I connect to Power BI data set using ADOMD.Net?

Hi!

 
I am using Microsoft.AnalysisServices.AdomdClient.dll, v13.0.0.0 to to access a Power BI data set from C# code. Have been experimenting with various connection strings but always get exceptions...

var connectionString = @"Provider=MSOLAP.7;Integrated Security=;Identity Provider=AAD;Data Source=https://analysis.windows.net/powerbi/api;Initial Catalog=XXXX-XXXX-GUID;Location=https://wabi-us-north-central-redirect.analysis.windows.net/xmla?vs=sobe_wowvirtualserver&db=XXX-XXX-GUID;MDX Compatibility= 1; MDX Missing Member Mode= Error; Safety Options= 2; Update Isolation Level= 2;User ID=my@workemail.com;Password=my_pswd;";
var conn = new AdomdConnection(connectionString);
conn.Open(); //throws here


The connection string above produces error "The connection either timed out or was lost."
This string is based on the .odc file that I downloaded from Power BI, and it works fine from Excel - data is loaded into pivot table, etc. (Excel uses COM driver I guess?)

If I set Integrated Security = SSPI or Basic, the client throws another error saying that neither of them can be used with HTTP.

What is missing in my code? I am looking for a working sample of a connection string for Power BI.

Thanks!

 

UPDATE: There is an inner exception for the connection string above: "The remote name could not be resolved: 'analysis.windows.net'" This url is what Power BI puts into odc file when I click on ANALYSE IN EXCEL. What url should I use to connect to data from .Net code?

3 REPLIES 3
Anonymous
Not applicable

Any updates on this? I am trying to do the exact same thing with the same errors and exceptions.

tomtom
Regular Visitor

The property Integrated Security=ClaimsToken has been working since version 13.0.1700.42 . The current version is available in Powerbi  (Microsoft.PowerBI.AdomdClient.dll) and Excel2016 (Microsoft.Excel.AdomdClient.dll).

 

Unfortunately, I could not find out what is still wrong. For the data source https://analysis.windows.net/powerbi/api I get the error message that the host can not be solved and if I https://wabi-north-europe-redirect.analysis.windows.net/xmla I get the error message the authentication is not possible.

Any update on this topic?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.