This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Windows 2012R2 x64
PowerShell ISE
Script from PBI as is:
while($true){
$endpoint = "https://api.powerbi.com/beta/xxxxxxxx"
$payload = @{
"Measured" =123
"DateTime" =Get-Date -Format F
"MachineName" ="Test"
"TargetValue" =1672
"MinValue" =0
"MaxValue" =6000
}
Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))
}
Return folowing error:
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At line:16 char:1
+ Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
What needs to be fixed ?
The same script working fine at Windows 10 Pro.
Hi @mrslyfox,
Did you solve it? Can you share the answer or mark the proper answer as a solution please?
Best Regards,
Dale
Hi @mrslyfox,
Since it works in Win 10, I would suggest:
1. Follow how-do-i-get-the-body-of-a-web-request-that-returned-400-bad-request-from-invoke to get more details of the error.
2. Check your code with the information in the Service.
3. A little possibility that caused by Firewall.
4. Upgrade the Power Shell.
Best Regards,
Dale
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |