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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Regular Visitor

How to Bind Dataset to Gateway using Service Principal?

As per, 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 (, 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?



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



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 [] followed by a Refresh Dataset in Group call []




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?




Helpful resources


Fabric certifications survey

Certification feedback opportunity for the community.


Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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