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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
thoBA
Regular Visitor

Custom data connector and Windows authentication

Hi,

I am trying to build a custom data connector that lets users navigate a folder structure on the local machine/network and import selected Excel Tables into PBI. The below example line "source = Excel.Workbook(File.Contents(url), null, true)" works without a problem using Windows authentication with "Use my current credentials" when executed directly in a Power BI Desktop query. However, when executed from within my custom data connector I receive the error message "Please specify how to connect" in the Connection dialog in PBI:

 

[DataSource.Kind="PQExtension1", Publish="PQExtension1.Publish"]
shared PQExtension1.File = (path as text) as table =>
let
   source = Excel.Workbook(File.Contents(path), null, true)
in
   source;

 

Data Source Kind is configured like this:

 

PQExtension1 = [ Authentication = [
   Windows = [
      // This key brings up the 'Use current credentials' and 'User Name' etc. edit boxes in the credential dialog in PBI
      SupportsAlternateCredentials = true ] ],
   Label = Extension.LoadString("DataSourceLabel") ];

 

Note, that it fails with the same error message also if I supply a user name and password instead for authentication.

I have also tried to send the current credentials to the File.Contents method File.Contents(path, Extension.CurrentCredential()). But this only results in the error "2 arguments supplied to a function that only expects one" - even though the documentation clearly states that File.Contents can accept a record as a second parameter.

 

What am I missing? I would be realy grateful if somebody could help me out with this authentication problem!

 

Edit :: I found the following text in the documentation at https://docs.microsoft.com/en-us/power-query/handlingdataaccess#data-source-kind

 

"Currently, a limited set of data source functions have been enabled to support extensibility.

So the basic data access functions, such as File.Contents(), are not supported for data connectors...?

1 REPLY 1
Anonymous
Not applicable

I'm facing a similar problem , only in my case I using Xml instead of Excel.

When testing my connector in Visual Studio, the "M Query Output" Error tab show this error:

"Credentials are required to connect to the  <ConnectorName> source. (Source: from c:\temp\file.xml to <ConnectorName>

 

When testing the connector in Power BI, getting this error:

"Please specify how to connect"

 

This thread is 7 months old. Please advise...

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.