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.
2,702 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,943 questions
Microsoft Defender for Cloud
Microsoft Defender for Cloud
An Azure service that provides threat protection for workloads running in Azure, on-premises, and in other clouds. Previously known as Azure Security Center and Azure Defender.
1,118 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pramod Valavala 20,501 Reputation points Microsoft Employee
    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

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful