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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ChopperDave
New Member

PowerShell Connection help

Hi,

I'm trying to get a service principal set up so I can connect to PowerBI with PowerShell. I want to do it in the background so the user won't have any interaction with the scripts.

I've been following along with a video a found https://youtu.be/WaKvZgjTWmo?t=2937  but am running into a permissions issue.

Get-PowerBIWorkspace : Operation returned an invalid status code 'Unauthorized'

I've set up the App Registration in Azure, set up a secret, and added the App as an admin on the PowerBI workspace. Also enabled developer settings in PowerBI and added a AD group that I set up to use PowerBI APIs. I even added the App as a member of the AD group despite it not being strictly instructed.

Maybe that's what I'm missing. I don't see any instructions on how to connect the AD group to the App.

I'd be happy to provide more information if needed.

1 ACCEPTED SOLUTION
ChopperDave
New Member

Turns out I'm blind and didn't see that you could add the Service Principal in the AD group. Spent way too long on that.
I'll keep my shame up here incase anyone else has the same problem.

View solution in original post

2 REPLIES 2
ChopperDave
New Member

Turns out I'm blind and didn't see that you could add the Service Principal in the AD group. Spent way too long on that.
I'll keep my shame up here incase anyone else has the same problem.
ChopperDave
New Member

It's defiantly an issue with the "Allow service principals to use Power BI APIs" setting. I enabled it for "The entire organization" and it started working.
Not sure how to get the App in the group that I have set up.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.