Forum Discussion

guilhermegranda's avatar
guilhermegranda
Regular Visitor
6 years ago

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-and-limitations, 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

  • heylumi's avatar
    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!