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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
powerbi_jenhen
Resolver II
Resolver II

Export-PowerBIReport Forbidden with Service Principle

Hi,

 

I'm attempting to use "Export-PowerBIReport" with service principle authentication to export a .pbix file to a local drive. I keep receiving the "Forbidden" error. Is this not possible with a service principle? I have also attempted to run this via powershell within a devops pipeline using an on-premise agent but again the same error is received. I can run Get-PowerBIReport with no issues via the service principle and I can use a domain account with PBI and local drive permissions to export the .pbix but how can I do this with a service principle? Ultimately I want to run this within a devops pipeline for archiving automation purposes.

 

Any help appreciated.

 

Thanks. 

1 ACCEPTED SOLUTION
powerbi_jenhen
Resolver II
Resolver II

I figured this out. Along with the admin portal/developer setting api permissions for service principals, they also need to be granted the permissions to download .pbix files:

 

powerbi_jenhen_0-1646405267724.png

 

View solution in original post

4 REPLIES 4
powerbi_jenhen
Resolver II
Resolver II

I figured this out. Along with the admin portal/developer setting api permissions for service principals, they also need to be granted the permissions to download .pbix files:

 

powerbi_jenhen_0-1646405267724.png

 

powerbi_jenhen
Resolver II
Resolver II

Hi,

 

Thanks for your reply. I can confirm that all the above has been set. I can run all API commands except "Export-PowerBIReport" via the service principle. If I use a domain account with PBI admin access and the export location access the "Export-PowerBIReport" command works. Can you confirm the Export command is a limitation with the service principle? Is there anyway to impersonate a domain account with service principle authentication to successfully export? I need to use service principle to avoid authentication prompts when running my Powershell tasks within DevOps pipelines.

 

Thanks.

Anonymous
Not applicable

Hi @powerbi_jenhen ,

First, please check whether you enable the following Power BI service admin settings in Admin portal:

1. Allow service principals to user Power BI APIs

yingyinr_0-1645771454204.png

2. Allow service principals to use read-only Power BI admin APIs

yingyinr_1-1645771575622.png

Then make sure that grant the access to the the workspace which the report located in with memeber or admin role.

yingyinr_2-1645771708382.png

And please check whether hit any following limitation of downloading a .pbix from a report

yingyinr_3-1645772496991.png

In addition, the following is the threads which has the same problem with yours. Hope they can help you.

Allow Export-PowerBIReport Is not working as admin #65

Permissions needed for Service Principal #51

Service Principle cannot Get-PowerBIWorkspace

Best Regards

My service principle has access to all Power BI Service scopes within our AAD application also

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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