gsimardnet / PowerQueryNet

Run M Language (Power Query Formula Language) from anywhere.
MIT License
189 stars 32 forks source link

Azure Blob Storage #30

Open tvinko opened 3 years ago

tvinko commented 3 years ago

I have a question about providing credentials to the Azure Blob Storage. I would like to read csv from storage. This is a simple powerquery:

let
    Source = AzureStorage.Blobs("my_account"),
    mycontainervar = Source{[Name="my_container"]}[Data]
in
    mycontainervar

I run it with (txtMashup.Text is just above query);


var q = new Query { Formula = txtMashup.Text };
var pq = new PowerQueryCommand();
var result = pq.Execute(q);

As expected, result.ExceptionMessage is: Credentials are required to connect to the AzureBlobs source. (Source at https://myaccount.blob.core.windows.net/my_container.)

Can anyone point me to the right direction how to provide those credentials (url, account name, key1)?

I also pass credential to PowerQueryCommand, but with no luck:

CredentialWeb web_credentials = new CredentialWeb();
web_credentials.Username = "account_name";
web_credentials.Password = "account_key_1";
web_credentials.Url = "https://myaccount.blob.core.windows.net/mycontainer";
pq.Credentials.Add(web_credentials);
var result = pq.Execute(q);