Intro to Azure API Management Service (APIM)

Azure API Management is a fully managed service to publish, secure, transform, maintain, and monitor APIs, API Management handles all the tasks involved in mediating API calls, including request authentication and authorization, rate limit and quota enforcement, request and response transformation, Mocking logging and tracing, and API version management.

Azure API Management has 3 Main components.

  1. The API gateway is the endpoint that:
    • Accepts API calls and routes them to your back ends.
    • Verifies API keys, JWT tokens, certificates, and other credentials.
    • Enforces usage quotas and rate limits.
    • Transforms your API on the fly without code modifications.
    • Caches backend responses where set up.
    • Logs call metadata for analytics purposes.
  2. The Azure portal is the administrative interface to
    • Define or import API schema.
    • Package APIs into products.
    • Set up policies like quotas or transformations on the APIs.
    • Get insights from analytics.
    • Manage users.
  3. The Developer portal serves as the main web presence for developers or end-users, where they can:
    • Read API documentation.
    • Try out an API via the interactive console.
    • Create an account and subscribe to get API keys.
    • Access analytics on their own usage

In My organization , we use Developer portal instead of Swagger for API definitions and it works great for us.

Let’s  Create API management  using Azure portal

  1. Login to Azure, go to Create a Resource, select Integration -> API Management.
  2. This opens the API Management Creation blade. Fill out all the information and pick a appropriate pricing tier,
  3. monitoring tab, Select App insights in Monitoring, I would highly recommend turning this feature on.
  4. Scale tab, Developer and consumption tier doesn’t offer scaling.
  5. Managed identity, assign identity for APIM to access other resources.
  6. Virtual Network, select external or internal to deploy APIM inside virtual network, APIM is access over internet in external type and accessible only internally in internal type , default it none.
  7. Protocol settings, APIM supports multiple versions of TLS protocol for both client and backend.
  8. Enter tags and review and create, it takes some time for APIM to deploy, be patient 🙂

Import an Azure Function App as a new API

  1. Navigate to APIM service that is created above in the Azure portal and select APIs from the menu.
  2. In the Add a new API list, select Function App.

  3. Click Browse to select Functions for import.
  4. Click on the Function App section to choose from the list of available Function Apps.
  5. Find the Function App to import Functions from, click on it and press Select.

  6. Select the Functions you would like to import and click Select.

 Note – You can import only Functions that are based off HTTP trigger and have the authorization level setting set to Anonymous or Function

Test the new API in the Azure portal

You can call API operations directly from the Azure portal, which provides a convenient way to view and test the operations.

  1. In the left navigation of APIM instance, select APIs -> Apimanagement-fa.
  2. Select the Test tab, and then select getUsers. The page shows Query parameters and Headers, if any. The Ocp-Apim-Subscription-Key is filled in automatically for the subscription key associated with this API.
  3. Select Send.

Useful links
https://docs.microsoft.com/en-us/azure/api-management/api-management-key-concepts

Conclusion
APIM is great very powerful tools to create consistent and modern API gateways for existing back-end services,we will learn more about APIM in future posts.

Thank you
Srinivasa Avanigadda

Intro to Azure API Management

One thought on “Intro to Azure API Management Service (APIM)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s