Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dw014_
New Member

Using a service principal to refresh credentials

Hi,

 

I am trying to user a service principal account to automatically refresh the data within a workspace. Currently a user has to authenticate every week. We have a workspace with a gateway and a number of connections, but I can't work out how to add the service principal account so that the data refreshes using that account. 

 

Any advice would be greatly appreciated.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@dw014_ You can have the user logon using the service principal account and publish the report. Also, you can refer to this thread: Using Service Account instead of Individual Accoun... - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

5 REPLIES 5
v-dineshya
Community Support
Community Support

Hi @dw014_ ,

Thank you for reaching out to the Microsoft Community Forum.

 

Please follow below steps to Enable Service Principal for Data Refresh via Gateway

 

1. You need to Register an App in Azure AD. Go to Azure Active Directory --> App registrations --> New registration. Use the Application (client) ID, Directory (tenant) ID, and create a client secret.

 

2. Grant the app permissions to Power BI Service (Dataset.ReadWrite.All, Gateway.ReadWrite.All). admin need to approve these permissions.

 

3. Need to Enable Service Principal in Power BI Admin Portal. Go to Power BI Admin Portal --> Tenant settings. Enable Service Principals for use with in Power BI APIs.

 

4. In Power BI Service, add the service principal as a member or admin of the workspace where the dataset resides.

 

5. Need to Configure Gateway Access. Go to Manage Gateways in Power BI Service. Add the service principal as a user of the data source and optionally as a gateway admin.

 

6. Need to check the dataset is bound to the correct gateway and data source. You need to use Power BI REST API or PowerShell to automate this. Use Power BI REST API for Refresh.

 

Authenticate using the service principal and acquire an access token.
Use the POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes endpoint to trigger a refresh.

 

Please refer Microsoft official document and community thread.

Create a connection with a service principal - Power Automate | Microsoft Learn

Service Principals in Fabric Data Warehouse - Microsoft Fabric | Microsoft Learn

Solved: How to configure service principal for a data sour... - Microsoft Fabric Community

Solved: Service Principal or Microsoft Account in refreshi... - Microsoft Fabric Community

 

I hope this information helps. Please do let us know if you have any further queries.

 

Regards,

Dinesh

Hi @dw014_ ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @dw014_ ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Hi @dw014_ ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

Greg_Deckler
Community Champion
Community Champion

@dw014_ You can have the user logon using the service principal account and publish the report. Also, you can refer to this thread: Using Service Account instead of Individual Accoun... - Microsoft Fabric Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.