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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Invoke-PowerBIRestMethod - https://api.powerbi.com/v1.0/myorg/admin/workspaces/getInfo

Hi,

 

I'm trying to use the PowerBI Scanner API, according to: https://www.youtube.com/watch?v=mmTklTT73gE

 

So, I'm able to call "GET-PowerBIWorkspace" and I'm getting workspaces where I have access as a response. 

If I try to use the Invoke-PowerBIRestMethod with the Workspace ID as Body, I recieve a Not Authorized Response, which doesn't make sense since I have all needed permissions. Any Ideas?

 

Used Code:

Login-PowerBIServiceAccount -ServicePrincipal -Credential (Get-Credential) -Tenant ******

GET-PowerBIWorkspace

$body = 
'{
    "workspaces": [
    "****"
    ]
}'

$url = "https://api.powerbi.com/v1.0/myorg/admin/workspaces/getInfo"
Invoke-PowerBIRestMethod -Url $url -Method Post -Body $body | ConvertFrom-Json

Result: 

Invoke-PowerBIRestMethod : Mindestens ein Fehler ist aufgetreten.
In Zeile:16 Zeichen:1
+ Invoke-PowerBIRestMethod -Url $url -Method Post -Body $body | Convert ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException
+ FullyQualifiedErrorId : Mindestens ein Fehler ist aufgetreten.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

Invoke-PowerBIRestMethod : Encountered errors when invoking the command: {
"code": "PowerBINotAuthorizedException",
"pbi.error": {
"code": "PowerBINotAuthorizedException",
"parameters": {},
"details": [],
"exceptionCulprit": 1
}
}

5 REPLIES 5
lbendlin
Super User
Super User

good - fix that issue and then you can continue with the implementation.

Anonymous
Not applicable

Hi thanks, but I didn't find a way to use the Rest Call in the sanbox. Do you know how I can try that? 

Anonymous
Not applicable

I can't login with my Service-Principal on that, only with my personal account and that one doesn't have enough rights.

lbendlin
Super User
Super User

does it work in the REST API sandbox?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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