Azure Logic Apps: How to Handle Dynamic Content in HTTP Requests with Authentication
Hey everyone, I'm running into an issue that's driving me crazy. After trying multiple solutions online, I still can't figure this out. I'm working on an Azure Logic App that needs to send dynamic content in the body of an HTTP POST request to an external API that requires Bearer token authentication. I'm using the HTTP action in the Logic App and I've set up a managed identity for authentication, but I'm running into issues with constructing the body of the request dynamically based on prior actions in the workflow. I've defined my HTTP action and set the method to POST. Below is a simplified version of what I have: ```json { "method": "POST", "uri": "https://externalapi.com/endpoint", "headers": { "Authorization": "Bearer @{body('Get_access_token')['access_token']}" }, "body": { "data": "@{triggerBody()?['data']}" } } ``` The scenario I'm working with is that the expression for the body does not seem to evaluate correctly. The behavior I receive is: "InvalidTemplate. Unable to process template language expressions in 'body': 'triggerBody()' is not valid in this context." I am confident that the preceding action is correctly defined and provides the expected output, but it seems like the Logic App is not able to access it. I've also tried using the 'Parse JSON' action to explicitly define the schema of the response from the previous step, but that didn’t resolve the scenario either. My current configuration is as follows: 1. The first action successfully retrieves the data I need. 2. I confirmed the output of the first action through the run history and it looks correct. 3. I've ensured that I'm using the correct expression syntax, but it still throws the same behavior. Is there a specific way to reference dynamic content in the body of an HTTP request in Azure Logic Apps, especially when dealing with authentication? Any guidance or examples would be greatly appreciated! This is part of a larger application I'm building. What am I doing wrong?