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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Anonymous
Not applicable

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

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. 

Anonymous
Not applicable

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

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.