Forum Discussion
Connect to Excel file in SharePoint library using Service Principal
Hi sujaza,
The error here during refresh is due to a runtime access issue with the binary content of the Excel file in SharePoint.When using the SharePoint Folder connector, power bi first accesses the document library and then reads the binary content of the excel file. This binary access step requires explicit permissions to read file contents, not just metadata.
While Sites.Selected and Files.Read.All permissions allow to see the metadata but the service principal also needs explicitly read access to the document library or file itself.
- Grant explicit read access to the service principal at the site or document library level using Microsoft Graph API. Assign read role to the app, this is mandatory when using Sites.Selected, without it power bi cannot read the file content.
- And also the root SharePoint site URL should be used in the SharePoint folder connector. Using a full file path may cause power bi to treat it as a Web connector internally, which does not support SPNs.
Thanks and regards,
Anjan Kumar Chippa
Hi v-achippa
Thank you again for the response!
I have since amended the API permissions on the Service principal to have Sites.Read.All and Files.Read.all for Graph API - Application permissions.
Can you please elaborate on "Grant explicit read access to the service principal at the site or document library level using Microsoft Graph API".
I have used root Sharepoint url of the site to access the site in the Folder connector.
The error remains!