Skip to main content
cancel
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.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.