Forum Discussion
Connect SharePoint List using Service Principal from Power BI service
- 1 year ago
Hi Anonymous - To connect to SharePoint from Power BI using a Service Principal Name (SPN) instead of personal credentials, follow these steps. It seems you've already registered the Microsoft Entra (Azure AD) app and created a service principal, so the issue might lie in permissions or configuration.
Please chck the steps below:
1. Ensure Microsoft Entra App Permissions are Configured Correctly
Application Permissions:Open the Azure portal.
Go to Azure Active Directory > App registrations > Select your app.
Navigate to API Permissions.
Add permissions for SharePoint:
API: Microsoft Graph
Permissions:
Sites.Read.All (to read all site collections and subsites)
Sites.Manage.All (if you need write permissions)
Click Grant Admin Consent for these permissions.
Set Up Roles on SharePoint Online:Go to the SharePoint admin center: https://<yourtenant>-admin.sharepoint.com.
In Advanced Settings, grant the App-only access by assigning the service principal to the desired site.
Site Permissions:Assign permissions directly to the app on the specific SharePoint site or library:
Go to the site > Settings > Site Permissions.
Add the service principal as a user (use the app ID).
2. Configure Power BI Service to Use Service Principal
Ensure you configure the data source correctly in Power BI:Install Power BI Desktop and Test with Service Principal:
In Power BI Desktop, when connecting to SharePoint Online:
Use the Organizational Account option.
Provide the Client ID and Client Secret of your registered app.
Enable SPN in Power BI Service:In Power BI Service, go to Settings > Admin Portal > Tenant Settings.
Enable Service principal authentication under Developer Settings.
3. Test SharePoint Connection in Power BI
In Power BI Service, follow these steps to set up the dataset connection:Set Up the Dataset:
In Power BI Desktop:
Connect to SharePoint Online using the app's credentials (Client ID and Secret).
Publish the report to Power BI Service.
Configure the Dataset Credentials:In Power BI Service:
Go to the Workspace where your dataset is published.
Select Settings for the dataset.
Under Data Source Credentials, choose OAuth2.
Use the Service Principal credentials (Client ID and Secret).
4. Troubleshooting Common Issues
Here are common causes of connection failures and their solutions:Issue: Missing Admin Consent
Make sure admin consent has been granted for the app permissions in the Azure portal.
Issue: SharePoint Permissions Not GrantedEnsure that the service principal (app) has the required permissions on the SharePoint site or library.
Issue: Dataset Not Refreshing in Power BI ServiceCheck the gateway (if using one) and ensure that service principal authentication is enabled in the gateway settings.
Issue: Authentication ErrorEnsure that you’re using the correct Tenant ID, Client ID, and Client Secret.
Verify the app registration details and ensure the client secret has not expired.
Hi Anonymous - To connect to SharePoint from Power BI using a Service Principal Name (SPN) instead of personal credentials, follow these steps. It seems you've already registered the Microsoft Entra (Azure AD) app and created a service principal, so the issue might lie in permissions or configuration.
Please chck the steps below:
1. Ensure Microsoft Entra App Permissions are Configured Correctly
Application Permissions:
Open the Azure portal.
Go to Azure Active Directory > App registrations > Select your app.
Navigate to API Permissions.
Add permissions for SharePoint:
API: Microsoft Graph
Permissions:
Sites.Read.All (to read all site collections and subsites)
Sites.Manage.All (if you need write permissions)
Click Grant Admin Consent for these permissions.
Set Up Roles on SharePoint Online:
Go to the SharePoint admin center: https://<yourtenant>-admin.sharepoint.com.
In Advanced Settings, grant the App-only access by assigning the service principal to the desired site.
Site Permissions:
Assign permissions directly to the app on the specific SharePoint site or library:
Go to the site > Settings > Site Permissions.
Add the service principal as a user (use the app ID).
2. Configure Power BI Service to Use Service Principal
Ensure you configure the data source correctly in Power BI:
Install Power BI Desktop and Test with Service Principal:
In Power BI Desktop, when connecting to SharePoint Online:
Use the Organizational Account option.
Provide the Client ID and Client Secret of your registered app.
Enable SPN in Power BI Service:
In Power BI Service, go to Settings > Admin Portal > Tenant Settings.
Enable Service principal authentication under Developer Settings.
3. Test SharePoint Connection in Power BI
In Power BI Service, follow these steps to set up the dataset connection:
Set Up the Dataset:
In Power BI Desktop:
Connect to SharePoint Online using the app's credentials (Client ID and Secret).
Publish the report to Power BI Service.
Configure the Dataset Credentials:
In Power BI Service:
Go to the Workspace where your dataset is published.
Select Settings for the dataset.
Under Data Source Credentials, choose OAuth2.
Use the Service Principal credentials (Client ID and Secret).
4. Troubleshooting Common Issues
Here are common causes of connection failures and their solutions:
Issue: Missing Admin Consent
Make sure admin consent has been granted for the app permissions in the Azure portal.
Issue: SharePoint Permissions Not Granted
Ensure that the service principal (app) has the required permissions on the SharePoint site or library.
Issue: Dataset Not Refreshing in Power BI Service
Check the gateway (if using one) and ensure that service principal authentication is enabled in the gateway settings.
Issue: Authentication Error
Ensure that you’re using the correct Tenant ID, Client ID, and Client Secret.
Verify the app registration details and ensure the client secret has not expired.
Hi rajendraongole1 Thank you very much for the detailed info. This really helps.
I would like to clarify two points with you:
1) For the below API permission currently we have site.selected permission with full control permission. But we are not able to connect having this Permission. So it seems like we have to go with site.read.all Permission right with admin Consent? Pls. confirm. Do we need site.write.all as well?
API: Microsoft Graph
Permissions:
Sites.Read.All (to read all site collections and subsites)
Sites.Manage.All (if you need write permissions)
Click Grant Admin Consent for these permissions.
2. Test SharePoint Connection in Power BI
How to test the sharepoint connection using cliend id and secret key. Pls. share your inputs on this
In Power BI Service, follow these steps to set up the dataset connection:
Set Up the Dataset:
In Power BI Desktop:
Connect to SharePoint Online using the app's credentials (Client ID and Secret).
Publish the report to Power BI Service.
Configure the Dataset Credentials:
- Ariel_Rosario1 year agoNew Member
did you get any clarification here?
- magfer3 months agoNew Member
Did you manage to get it working?