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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
bingo
Microsoft Employee
Microsoft Employee

How to upload a new .pbix file to the workspace use service principle with powershell

I want to achieve CD in devops to upload the pbix file to the powerBI service use the release pipeline. Now I can get the workspace info use Get-PowerBIWorkspace -All, but meet 'unauthorized' error when use the New-PowerBIReport -Path "$($reportFile.Fullname)" -Name "$($reportFile.Basename)" -Workspace $destinationWorkspace -ConflictAction "Overwrite" -Timeout 2000. How to do, do you have any idea, thanks.

bingo_0-1703662919230.png

 

2 REPLIES 2
rubayatyasmin
Super User
Super User

@bingo 

 

That's like trying to get into a private party without an invite. Here's what you might wanna check:

  1. Permissions: Make sure your access pass (service principal) is the real deal and it's got the VIP pass to the Power BI workspace. It needs to be the boss to let your report in.

  2. Token: That's your secret handshake. If it's old or wrong, the door won't open. Make sure it's fresh and correct.

  3. Check the address: The workspace ID is like the party address. If it's wrong, you're knocking on the wrong door.

  4. Script Setup: Think of it like the car you drive there. Make sure it's got everything it needs to get you to the party – all the right credentials and stuff.

  5. Update Your Gear: If your PowerShell module is old school, it might not jive with the new Power BI moves. Get the latest version.

If you've checked all this and it's still a no-go, you might need to reset your handshake (token) or double-check you've got the right permissions.


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Hi, thanks. I can login and get sccesstoken using service principle, and can get the workspace info through the command Get-PowerBIWorkspace -All, but faild when executing the command NewReport. Do you know whether the method is feasible, I am wondering whether it is feasible to achieving upload new report, as I see somewhere say the service principle can only access to read-only api.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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