BadRequest when Create Or Update Host Secret (aka Api Key) for Function App
24 Jul 2020When creating or updating host secret (aka ApiKey) for Function App using ARM Api, have you ever received a error message “Properties object is not present in the request body.”? Well I did.
Here’s full error response body I was receiving:
Message states, I’m sending incorrect body. So what I’m sending in the body? Just a simple JSON:
Let’s see in the docs: https://docs.microsoft.com/en-us/rest/api/appservice/webapps/createorupdatehostsecret#request-body.
According to thee docs, I should send just two parameters in the body “name” and “value”:
Name | Type | Description |
---|---|---|
name | string | Key name |
value | string | Key value |
Looks easy. But ARM Api keeps telling me something is missing. Not so easy, though. How should correct JSON look like then?
Correct JSON should look like so:
Thats it! Simple, isn’t it?
Bonus: how to create Function App Host Secret using PowerShell.
Thanks for reading!