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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Sapphire
Regular Visitor

Using Power BI's APIs in powershell scripts - 400 status error

Sapphire_0-1618593941596.png

 

Hello, I am new to powershell and was working on using Power BI REST APIs. I have no problems with the ones using read permissions, but when it comes to the ones to write (POST), i am getting the following error:

 

Exception : System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.<InvokeRestMethod>d__35.MoveNext()   (the error is on the image on top!)

 

In this case i was using the following for the "update parameter in group" REST API:

 

Invoke-PowerBIRestMethod -Url $url -Method POST -Body (ConvertTo-Json #body_request)

 

$body_request = @'
{
"updateDetails":
{
"name": "ServerName",
"newValue": "qa-clean"
}

}
'@

 

I may be wrong, but I read documentation before which told that administrators can use the Power BI APIs without needing to register an app in azure. Is this fact true?

 

Thank you for reading:)

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User
1 REPLY 1
lbendlin
Super User
Super User

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors