Skip to main content

16 posts tagged with "PowerShell"

PowerShell Scripting and Automation

View All Tags

Fixed: "Response status code does not indicate success: 415 (Unsupported Media Type)" from Invoke-WebRequest

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

The same request worked from curl and failed from PowerShell: Invoke-WebRequest: Response status code does not indicate success: 415 (Unsupported Media Type). When a POST has no -ContentType, PowerShell labels it as form data, and my Microsoft 365 Agents SDK agent's endpoint only accepts JSON. Adding -ContentType "application/json" fixes it.

How to Look Up Azure OpenAI Model Prices with the Azure Retail Prices API

· 12 min read
Jagdish Kumawat
Founder @ Dewiride

A cost estimate is only as good as the price in it, and model prices change. Microsoft publishes every Azure price, including what each Azure OpenAI model costs per million tokens, through the Azure Retail Prices API: a public web address that needs no Azure account. This guide finds one model's prices, decodes the meter names, narrows the list to one deployment type and converts it to another currency, with curl and jq or with PowerShell.

How to Test a Race Condition in a Web API from the Terminal

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A race condition doesn't show up when you send one request at a time. You need several at the same moment, and you don't need a load-testing tool: curl with xargs does it on macOS and Linux, and ForEach-Object -Parallel does it in PowerShell. Then check what's in the database, because the status codes alone can look fine.