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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
Anonymous
Not applicable

404 Error with Invoke-PowerBIRestmethod, Get Refresh History In Group

Hi all,

I'm trying to do some basIc scripting to regularly pull my PBI refresh history as part of a bigger set of usage metric tracking, using Azure function apps. All my functions log in to PBI with a service principal that has delegated Tenant.ReadWriteAll permissions, like so:

 

$applicationId = "bbd694ab-1da9-426f-97ab-896661bc32a7"

$securePassword = "[redacted]" | ConvertTo-SecureString -AsPlainText -Force

$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $applicationId, $securePassword

Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId "93fb7985-8893-49e5-8440-bb350d28a54f"

 

This works fine for most things, including most API URLs for Invoke-PowerBIRestMethod, but when I try to use Invoke... with the Get Refresh History In Group call I get a 404 error. This *only* happens when I'm accessing the API as the service principal; if I make the API call in Postman using an Authorization header it works fine. My query is

 

 

$url = "https://api.powerbi.com/v1.0/myorg/groups/f1f6f5db-02b3-4650-a4aa-fc93171aede9/datasets/173489c2-285c-484d-ac0d-7e382eec87ce/refreshes"

invoke-powerbirestmethod -Url $url -method Get 

 

I get 404s like this on every non-admin API call; the admin versions all work fine.

 

I'm pretty new to working with Powershell and the world of Azure so this is probably something pretty obvious, but it's eating my lunch.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

I have check Power BI REST API offical blog and I think Get Refresh History In Group API should support Service Principal.

If 404 error only appears when you choose Service Principal for authentication, please check whether you configure Service Principal correctly. You should give security group which has added Service Principal as a member the API permission from Admin portal in Power BI Service and add Service Principal as a member in Power BI Workspace.

For reference: Embed Power BI content with service principal and an application secret

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

I have check Power BI REST API offical blog and I think Get Refresh History In Group API should support Service Principal.

If 404 error only appears when you choose Service Principal for authentication, please check whether you configure Service Principal correctly. You should give security group which has added Service Principal as a member the API permission from Admin portal in Power BI Service and add Service Principal as a member in Power BI Workspace.

For reference: Embed Power BI content with service principal and an application secret

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.