cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ed-freeman Frequent Visitor
Frequent Visitor

Initializing Dataflow data source credentials programmatically

Hi everyone.

 

We are successfully importing a dataflow using the Post Import in Group API. Its data source is an Azure SQL DB. However, for the dataflow to properly load & be refreshed, we need to supply credentials for the data source(s). This can be done manually - either by trying to edit the dataflow entity or by opening up the dataflow settings. But can this be done programmatically?

 

For datasets, it seems that one can use the Update Data Sources in Group API to edit the credentials and provide a connection string. But there doesn't seem to be an equivalent for dataflows. 

 

Ideally, we want a fully-automated way of creating a ready-to-use dataflow, but we can't seem to figure out a way of setting the credentials programmatically.

 

Does anyone have a solution to this?

 

Thanks,

 

Ed

4 REPLIES 4
Community Support Team
Community Support Team

Re: Initializing Dataflow data source credentials programmatically

Hi @ed-freeman ,

If you are not familiar with REST API or program coding, I'm not so recommend you to try this method.

Spoiler
Logic:
1. Setting up a looping function with correspond conditions for start and stop.
2. Coding 'get access token', 'get data from azure sql', 'push data to rest api' methods.
3. Use looping functions to invoke above methods.

AFAIK, the simple way to achieve automatic refresh is create a dataflow based on sql connector and configure correspond data credentials.(azure sql not require gateway to handle refresh)

Creating and using dataflows in Power BI

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
ed-freeman Frequent Visitor
Frequent Visitor

Re: Initializing Dataflow data source credentials programmatically

Hi Xiaoxin,

 

Thank you for the reply!

 

We know we can use "Push Datasets" to create datasets in the Power BI Service. But we're not creating a dataset, we're creating a dataflow.


We are currently successfully using the API to import the dataflow. The dataflow "structure” is imported fine, but we don't know of any way to set up the credentials programmatically. We know we can set up the credentials manually, but that's exactly what we want to avoid.


If you know of any way to set up dataflow credentials programmatically, we'd love to hear how Smiley Happy

 

Thanks again,

 

Ed

 

Community Support Team
Community Support Team

Re: Initializing Dataflow data source credentials programmatically

Hi @ed-freeman ,

In fact, power bi official document already list how to get access token.(tutorial step 2)  Please check following document to know more about this: (include sample code)

Step 2: Get an authentication access token

After these, you only need to write a looping function based on timer to invoke getToken function to get new token before current token expired.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
ed-freeman Frequent Visitor
Frequent Visitor

Re: Initializing Dataflow data source credentials programmatically

Hi @v-shex-msft,

 

Thank you for your response, but I think you're misunderstanding my problem. I'm not trying to use the Push Data capability.

 

I have an Azure SQL Database. I'm programmatically creating a Dataflow (using the Post Import in Group API)) which connects to that database. However, before I can access the dataflow in the Power BI Service I need to manually enter the credentials (username & password) for the Azure SQL Database. I am wondering whether this part can be done programmatically.

 

Regards,

 

Ed

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Top Kudoed Authors
Users Online
Currently online: 64 members 998 guests
Please welcome our newest community members: