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

Set datasource credentials programmatically

We are building an ISV application that uses Power BI embedding for rendering of Power BI reports.  This application will be distributed to client sites and each will have different database logins (username/password) for all their reports.

 

We need a way to programmatically (and securely) set these datasource credentials at runtime when a user attempts to run the report.  These credentials cannot be appended as parameters to the URL or other insecure methods.

 

Does anyone have a method for doing this dynamically in C#?  Your help is much appreciated.

Ronny

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Set datasource credentials programmatically

HI @rshahrabani,

I'd like to suggest you take a look at gateway update data source api and try to use it to set data source credentials.

Gateways - Update Datasource 

BTW, I don't think it is possible to update credentials every time when the user accesses. Maybe you can try to set dynamic RLS based on username and configure them in user data.

Row-level security with Power BI Embedded 
Regards,

Xiaoxin Sheng

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

Re: Set datasource credentials programmatically

Hi @v-shex-msft,

 

The Gateways - Update Datasource will modify the credentials on the report residing in the Power BI service, and Row-level security will limit the data to a subset given the username. What we are trying to do is to allow execution of a report's datasource login to be configured for different users.

 

For example, a client site will have 3 databases (development, QA and production) with identical structures (but different data).  The development site will execute the report residing on Power BI service with one set of database credentials (username/password) and the QA site will execute the same report on Power BI service with a different set of credentials. This database login needs to be established at runtime with different credentials for each of these platforms (dev, QA and prod).

 

Is there any way to do this programmatically within our Power BI embedded app?

 

Thanks,

Ronny

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors