Forum Discussion

Graham-TA's avatar
Graham-TA
New Member
2 years ago

Use a Service Principal with a Certificate as Credentials for a Datasource

I'm working on a project to automate this process via API calls:

  • Import a PBIX file including a Dataset with one datasource, which is linked to an Excel file in SharePoint
  • Change the Datasource to a different Excel file in SharePoint (with the same structure)
  • Clone a report and link to the Dataset
  • Set a refresh schedule

The issue I'm facing is that once the PBIX file is imported, it cannot be sucessfully refreshed, either with the original datascource or the updated one. If I use the web UI I can edit the credentials and then the refresh will be successful, but this doesn't help with automating the process. 

 

I considered using the API to update the gateway credentials, using an OAuth2 token, however I read that the API does not handle refresh tokens, so this is only good for one hour. The other approch is to use a Service Principal for the credentials, however I can only see options to use a client (app) id with client secret. Using a client secret doesn't work with SharePoint, it seems SharePoint will not authentiate a Service Pricipate with a client secret, it needs to use the certificate method. 

 

Is there any way to use a certificate to authenticate the Service Principal in a gateway?

2 Replies