Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
mmccarver
Frequent Visitor

Gateways.UpdateDatasourceAsync and PATCH gateways/{gatewayId}/datasources/{datasourceId}

I'm using service principal in a multi tenant scenario as follows

 

1. create profile

2. create workspace

3. import report .pbix file

4. add myself as an admin (both service principle and myself are admins)

5. Update the server and database name via POST groups/{workspacedId}/datasets/{datasetId}/Default.UpdateDatasources

 

And finally, I need to set the service principal as the Azure SQL db login for the datasource. 

 

I can't figure this last part out. Our Azure SQL instance is configured to only allow AD login and the service principal has rights to use the database. 

 

 

4 REPLIES 4
v-shex-msft
Community Support
Community Support

Hi @mmccarver,

For multi tenancy scenario, service principal credentials not able to use across different tenants, do you need to register different credentials for different tenant usages.

BTW, current service principal seems only work for some read-only permission admin API, so if you need to use these type of admin API, you should double-check on them to confirm if they allow to use with service principal credentials.

Embed Power BI content in an embedded analytics application with service principal and an applicatio...

Also, Power BI admin rights are required to enable service principal in developer settings within the Power BI Admin portal. You should have confirmed you have admin permission to enable the service principal on your tenant.

Enable the Power BI service admin settings

Regards,

Xiaoxin Sheng

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

I followed this guide: Embed Power BI content in an embedded analytics application with service principal and an applicatio...

 

I completed these steps already. I'm using the REST api with a service principal to create profiles, workspaces, and import a set of direct query reports for each new tenant/customer. 

 

I need to update something somewhere so that when the embedded report loads, it connects to the correct customer database. Our azure databases are AD login only. I can't use a username/password. The service principal has access to the azure sql database. I've even created a vnet gateway and verified that it can connect. 

 

I need to update the customers dataset or datasource to point to the correct database and tell it to use the service principal to connect. 

Hi @mmccarver,

Current power bi rest API allow you to use service principal to invoke 'update data source' API to work with Azure SQL , and the updated data source credentials should match with database configuration.(you mentions it only allow to use AD, so I think you can't use 'service principal' as credentials to connect the datasource)

So I think you may need to enable 'service principal' on Azure SQL at first, then you can use it as credentials to connect and update the data source in REST API:

Azure authentication with service principal - Java on Azure | Microsoft Learn

Regards,

Xiaoxin Sheng

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

Thank you for your reply. I have confirmed that the service principal I use to update the report's datasource has access to the Azure SQL instance. I observed successful connections in the Azure SQL logs when creating "cloud data connections" in the power bi app. 

 

I want to update the datasource credentials via API. It seems that only Basic, oAuth, Key, etc are supported in the API. 

 

Here is an image of a creating a data connection that uses "service principal" authentication.

 

I would like to be able to create these via API and point a report's dataset to this connector. 

spDataConnection.png

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.