Stop POSTMAN from Accessing API in Azure API Management Service

Ziggy Zulueta 495 Reputation points MVP
2023-04-10T02:24:36.18+00:00

I have been going over the Azure API Management Service and I have one basic question: How do we stop POSTMAN from accessing it?

I have an application created via Azure Static Web App that accesses a front-end API (via Azure API Management) with a back-end API (via Azure Functions). The back-end API has the credentials of a service so it is imperative it is not seen by the public. The Static Web App needs an Ocp-Apim-Subscription-Key to access the API and it also need a Functions Key to access the back-end API. Those are not hard-coded in the front-end and are setup in the Azure Static Web App Configuration. The Static Web App has a back-end API to access the two keys to access the API. The API then calls the back-end API (Azure functions). While this solution may look great, the issue here is that POSTMAN can all access these. So a normal person may not be able to see it but can still use POSTMAN to access. So how do we stop this?

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

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-04-10T18:05:36.8466667+00:00

    Ziggy Zulueta Thanks for posting your question in Microsoft Q&A. Unfortunately, you cannot reject requests from a specific client such as Postman since user-agent is editable in the app and there is no static IP or IP ranges as you mentioned.

    However, in addition to Ocp-Apim-Subscription-Key you can protect APIs in APIM with client certification authentication or using OAuth 2.0 authorization with Azure AD, Azure AD B2C and validate the access token using validate-jwt policy. This provides secure access to APIs and the clients need to have either certificate or access token for accessing it. Refer docs for reference: https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-protect-backend-with-aad, https://learn.microsoft.com/en-us/azure/api-management/howto-protect-backend-frontend-azure-ad-b2c, https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-mutual-certificates-for-clients.

    For specifically Static Web Apps as a client, we have API support with APIM and refer to docs: https://learn.microsoft.com/en-us/azure/static-web-apps/apis-api-management for more info. (Similar discussion in your other thread). I hope this helps with your question and let me know if you have any other.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.


0 additional answers

Sort by: Most helpful

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.