Forum Discussion

rshahrabani's avatar
rshahrabani
Frequent Visitor
6 years ago
Solved

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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    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

    • rshahrabani's avatar
      rshahrabani
      Frequent Visitor

      Hi Anonymous,

       

      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