Securing APIs with the Most Secure API Management Instance

hampton123 1,175 Reputation points
2023-12-21T22:24:21.7166667+00:00

I'm currently utilizing the consumption-based API management service to oversee my Azure Functions, using a self-hosted developer portal from my Azure Storage account. The primary challenge I'm encountering lies in the interaction with Azure Functions, where both B2C login credentials and an APIM subscription key are mandatory.

Considering a transition to higher tiers of APIM, specifically for the convenience of a pre-built developer portal, I've observed a security issue. The JWT token from my B2C user flow doesn't seem to pass through to the function when invoked through APIM's developer portal. Consequently, this leaves only the subscription key as the protective measure for APIs external to the developer portal.

My aim is to opt for the most secure version of the API management service to fortify my APIs. I was wondering whether there's a consensus on the most secure version or if the choice is dependent on individual use-cases and specific requirements.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,446 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sonny Gillissen 3,751 Reputation points Volunteer Moderator
    2024-01-08T10:02:42.6133333+00:00

    Hi hampton123,

    Thank you for reaching out on Microsoft Q&A!

    If I understand you correctly you've got an APIM set up with an API endpoint pointing to your Azure Function, right? By design Web Apps, which is basically the base layer of an Azure Function, ignore the 'Authorization' header completely. Therefor not showing in the app.

    One of the reasons being that it's not a security risk that the Authorization header is ignored, as in a zero-trust principle you would not want Authorization details to pass every hop in the chain. Every resource should do it's own authorization. So =the fact that the subcription key is passed is the actual security risk here.

    If you may need the Authorization header, for example if you need the details in the Azure Function for processing and/or validation, you could convert it to a custom header as below:

    <set-header name="X-Custom-Authorization" exists-action="override">
       <value>@(context.Request.Headers.GetValueOrDefault("Authorization"))</value>
    </set-header>
    

    You can then make your Azure Function look for that specific header, which enables you to get the Authorization header details still, be it with another name. But, as mentioned, bear in mind that passing through security headers is a risk.

    Please click “Accept answer” if you find this helpful. Feel free to drop additional queries in the comments below!

    Kind regards,

    Sonny


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.