Using raw JSON to post request Azure Key Vault?

PK 1 Reputation point
2022-12-12T21:34:16.447+00:00

For my implementation I have to use raw JSON to send a post request to Azure Key Vault.

Using form-data in Postman I don't have any problems.

Switching the body to raw-JSON I get the 400 error code.

Is it impossible to send requests in raw-JSON? Is there a way to turn on this feature?

269729-3ae9c5f0-6bd1-48ca-a1ca-01b703493ee4.jpeg

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. PK 1 Reputation point
    2022-12-13T21:47:20.657+00:00

    This endpoint cannot read raw JSON.

    The only solution is to modify the request body to use urlencoded format.

    In Postman this can be done by changing the content type to: application/x-www-form-urlencoded

    and the body to Raw with the content inside the body as &{key}={value} for every key, value that the endpoint requires.

    0 comments No comments

  2. Shweta Mathur 30,431 Reputation points Microsoft Employee Moderator
    2022-12-14T12:49:07.98+00:00

    Hi @PK ,

    Thanks for reaching out.

    Your understanding is correct here.

    To call the token endpoint to get the token, post request needs to send to login.microsoftonline.com with content-type : application/x-www-form-urlencoded .

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. I'll repost your solution in case you'd like to "Accept" the answer so it will help members in community looking for similar issue.

    270611-image.png

    Thanks,
    Shweta

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.