[Azure Api Management] How to forward Authorization Header to Backend

Raphael Silva 0 Reputation points
2025-03-13T17:20:28.1033333+00:00

Hello,

I configured my Api management instance to pre validate jwts with the validate-azure-ad-token policy, and it's working as expected.

But I also want to forward the same authorization token to the backend so it can also validate it and use information such as client id to generate logs.

Is that possible? If so how?

I've tried the set-header policy in the inbound config but with no success:

<set-header name="Authorization" exists-action="override">

    <value>@(context.Request.Headers.GetValueOrDefault("Authorization", ""))</value>

</set-header> 
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,337 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Loknathsatyasaivarma Mahali 810 Reputation points Microsoft External Staff
    2025-03-18T19:07:58.0366667+00:00

    Hello Raphael Silva,

    One possible solution is to use the forward-request policy instead of set-header. The forward-request policy allows you to forward the entire incoming request, including all headers (such as the Authorization token), directly to the backend service. Here’s an example of how you can use the forward-request policy: <forward-request />

    By using the forward-request policy, you can pass the entire request—including the authorization token—onto the backend for further validation and logging purposes.

    Make sure the forward-request policy is placed in the inbound section of your API Management policy configuration.

    If you encounter any issues or need further assistance with this approach, feel free to let me know. It would also be helpful if you could share any specific error messages or details you're encountering so I can provide a more targeted solution.


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.