Getting the authentication token from LogicApp/Postman

Sascha 20 Reputation points
2023-07-28T09:23:25.0833333+00:00

Hello fellas.

Usually I try not to bother anyone and try to find the solution on my own, but this time I got stuck.

I am developping the LogicApp to do some stuff in the Defender for Cloud. The issue I am facing is obtaining token from the AAD. This is how I call POST method from LogicApp:image

I read somewhene that "resource" should not be a part of the body, but I get same result w/ or w/o it.

When I execute this method, I get en error:

{
  "error": "invalid_request",
  "error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: a0fb2806-95b8-491e-9927-bf4b7e0b0e00\r\nCorrelation ID: d6971532-4e0a-4457-87d6-0bc7c7ba0bd6\r\nTimestamp: 2023-07-28 09:06:32Z",
  "error_codes": [
    900144
  ],
  "timestamp": "2023-07-28 09:06:32Z",
  "trace_id": "a0fb2806-95b8-491e-9927-bf4b7e0b0e00",
  "correlation_id": "d6971532-4e0a-4457-87d6-0bc7c7ba0bd6",
  "error_uri": "https://login.microsoftonline.com/error?code=900144"
}

Funny thing is that there is 'grant_type' in the body.

Even more funny thing is that the method invoked from Postman, using same parameters and values work just fine:

User's image

User's image

Obviously I am missing something, but what?

Any help much appreciated!

Sascha

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,542 questions
Microsoft Security Microsoft Defender Microsoft Defender for Cloud
Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Pramod Valavala 20,656 Reputation points Microsoft Employee Moderator
    2023-07-28T11:20:03.33+00:00

    @Sascha On first look, I believe it might be because the header should be Content-Type instead of Content_Type perhaps.

    Also, if you are using this token later in a HTTP Action, note that you could also explore using the Azure AD OAuth Authentication option of the action directly as well.

    User's image

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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