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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
guilhermegranda
Regular Visitor

How to Bind Dataset to Gateway using Service Principal?

As per https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal#considerations-..., I can see that "You can't install or manage an on-premises data gateway using service principal". The thing is, I just need, as a Service Principal, to bind an existing Gateway Data Source to a Dataset. The Gateway Datasource will be created manually by the Gateway Administrator.

 

I have tried using the Bind to Gateway API (docs.microsoft.com/en-us/rest/api/power-bi/datasets/bindtogateway), with no luck. Can only make the API work by impersonating a User instead of a Service.

 

Did anyone managed to bind a gateway datasource to a dataset using a Service Principal yet?

 

Thanks

4 REPLIES 4
heylumi
Regular Visitor

I too am experiencing the same behavior and would appreciate any assistance or tips if anyone has managed to get around this. The intention would be to automate the process of:

1) Deploying a report to a workspace (works)

2) Configuring any parameters (works)

3) Taking over the dataset (works)

3) Specifying the use of the gateway (a mapped datasource should already exist, a single locally hosted MSSQL database in this instance). Struggling at this step.

 

So far I have noticed that the discover-gateways-in-group method seems to return no gateway id when running this as a service principal but does seem to return a gateway id when running as an impersonated user. This is true even if the service principal is added as a user to the datasource for the gateway or as a gateway admin. I've also tried giving the service principal the scope permissions mentioned in the documentation - DataSet.ReadWriteAll

[https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/discover-gateways-in-group]

 

Is there an additional step that is required in order for the service princiapal to make use of datasources that have already been manually created? I suspect I may be missing something. 

 

I am primarily using PowerShell and making any required Rest calls using the Invoke-PowerBIRestMethod.

 

Would very much appreciate any guidance or suggestions!

 

For anyone interested, there is a video that explains this process quite nicely : Service Principal Data Gateway Refresh 

 

As at the time of writing:

-Needed to add the service principal as a data source user for the respective data source in the gateway

-Needed to add the service principal directly (as opposed to adding via a group). This may simply have been a misconfiguration on my side but ultimately got it working by adding the service principal as a data source user via the DataGateway commandlet (needed to use PowerShell 7)

-Once the service principal was added I was able to use the Bind To Gateway rest call [https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/bind-to-gateway] followed by a Refresh Dataset in Group call [https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/refresh-dataset-in-group]

 

 

 

AntonioCasado
Frequent Visitor

Hi @guilhermegranda,

 

I've got the same problem. Did you was able to sort this out? or can someone help with this, please?

 

Thanks.

anyone?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.