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
Anonymous
Not applicable

Error using Invoke-PowerBIRestMethod using a service principal

Hello Community,

 

I followed the steps below to use the powershell Invoke-PowerBIRestMethod using a service principal but facing errors getting the details of the group or dataset.

I followed the below steps:

- Created a service principal in Azure AD

- Assigned permissons per screenshot below

no_one_0-1668137871282.png

- Able to login using service principal details using Connect-PowerBIServiceAccount successfully

- Added service principal as Admin to the Power BI workspace

- Enabled the setting "Allow service principals to use read-only power bi admins APIs" in the power bi admin portal

- Added the Service Principal to the correct AD Group

- Then tried to run Invoke-PowerBIRestMethod -Url 'groups' -Method Get

Then I get the error below:

Invoke-PowerBIRestMethod : One or more errors occurred.
+ Invoke-PowerBIRestMethod -Url 'https://app.powerbi.com/v1.0/myTenantId/groups' -Method Get
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

Response status code does not indicate success: 500 (Internal Server Error).

Category : WriteError
Activity : Invoke-PowerBIRestMethod
Reason : AggregateException
TargetName : Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod
TargetType : InvokePowerBIRestMethod

Response status code does not indicate success: 500 (Internal Server Error).
System.Net.Http
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.<InvokeRestMethod>d__35.MoveNext()

 

- Am I missing additional permissions on the service principal?

- Do I need power bi enterprise admin rights?

- Any typos or stuff I have missed?

 

I checked the other posts on this topic before posting here but they did not help resolve my issue 🙂

Your help is appreciated!  

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You are asking for groups that the authenticated entity is a member of. You may not have added that service principal to any workspaces.  If you had intended to do this in tenant level then you should use Admin - Groups GetGroupsAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

You are asking for groups that the authenticated entity is a member of. You may not have added that service principal to any workspaces.  If you had intended to do this in tenant level then you should use Admin - Groups GetGroupsAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn

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.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

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.

Top Solution Authors