Passing extra HTTP headers to any action in Logic App


Here's a trick not easily discoverable for Azure Logic App's triggers and actions: you can actually pass any HTTP header that you need. Except for the HTTP action and a few others that explicitly supports headers in their input Open API definition, you need to switch to code view to manually add them. Then you can follow the same syntax as for the HTTP action, documented here: https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-actions-triggers#http-action

Which in short is:

"myLatestNewsAction": {
    "type": "<something>",
    "inputs": {
        "headers": { "Accept-Language": "en-us", "Content-Type": "application/json" },
        "method": "<some HTTP verb>",
        "uri": "https://mynews.example.com/latest"
    }
}

Do note that the Logic App designer upon further edition of the Logic App definition will only preserve the parameters that map to triggers' and actions' Open API definition. This above not been in the definition for most of them will be stripped out. So either you need to do your edits in code view only, or each time you need to use the Designer help to change the Logic App, make first a copy of your extra headers so you can paste them back where needed in code view once done with the Designer edits.

I am frequently using this trick to pass API Management trace requests while troubleshooting customer issues. I do hope such tracing will eventually be possible for all developers through the use of top #2 asked UserVoice feature https://feedback.azure.com/forums/287593-logic-apps/suggestions/16846093-bring-the-power-of-logic-apps-in-azure-stack or similar dedicated offering in which one would be in control of a private API Management instance as well.

Comments (0)

Skip to main content