Forum Discussion
ADLS Gen2 Power Query custom connector
Thanks for instant reply rubayatyasmin. There is a small progress I would say 🙂 However, when used code from Your example I got this error message in Power BI:
"We cannot convert the value "?sv=2021-12-02&st=20..." to type Record."
(the value mentioned is my SAS key I guess)
When I checked in function refference, AzureStorage.DataLake() does not accept SAS as an argument. Possible optional arguments are: BlockSize, RequestSize, ConcurrentRequests and HierarchicalNavigation. Not sure where I can pass SAS than...
Also, when connecting from Power BI using the given method, it asks me to provide account key. Any ideas why?
Here is my current data connector logic:
[Version = "1.0.0"]
section BDL_Powerbi_Connector;
[DataSource.Kind="BDL_Powerbi_Connector", Publish="BDL_Powerbi_Connector.Publish"]
shared BDL_Powerbi_Connector.Contents = (accountName as text, sasToken as text) as table =>
let
accountName = accountName,
sasToken = sasToken,
dataLake = AzureStorage.DataLake(accountName, sasToken),
contents = dataLake{[#"Folder Path"="dataproducts/",#"File Name"="test.txt"]}[Content]
in
contents;
// Data Source Kind description
BDL_Powerbi_Connector = [
Authentication = [
Key = []
]
];
The AzureStorage.DataLake() function indeed does not accept SAS token as a parameter, which is why you're seeing the error message "We cannot convert the value "?sv=2021-12-02&st=20..." to type Record."
As a workaround, one possibility could be using Azure Function or Logic App to mediate between Power BI and ADLS Gen2. You can pass the SAS token and other details to the Azure Function/Logic App, and then use that to read data from ADLS Gen2. This is more complex and requires hosting an Azure Function or Logic App, but it can provide the functionality you need.
The AzureStorage.DataLake function requires account key for authentication.