Azure Function 400 Bad Request

I was writing these articles and received this error when calling my Azure Function:

[Info] The following Exception happened: Response status code does not indicate success: 400 (Bad Request).

I narrowed it down to the request I was making to my Azure Key Vault secret, the URL I was requested looked similar to this:

https://?.vault.azure.net/secrets/DatabaseConnectionString/c88###?api-version=2017-09-01

which looked correct and matched the examples I had to work with.

Then I decided to use Postman to perform the same request.  Having already written these articles, I was ready to go with it:

I needed a token for authentication and once I configured Postman and executed the REST call, I received the solution as seen in Figure 1.

image

Figure 1, 400 Bad Request Azure Function App, Azure Function

I changed the api-version in my URL and bang!, Figure 2.

https://?.vault.azure.net/secrets/DatabaseConnectionString/c88###?api-version=2016-10-01

image

Figure 2, 400 Bad Request Azure Function App, Azure Function