DEV Community

Karthik Ganesan
Karthik Ganesan

Posted on • Originally published at serverless360.com

Using APIM as a Proxy for Serverless360 BAM

Many companies like all their API calls to external services routed through Azure API Management (APIM). If you are a user of Serverless360 BAM, then one of the options is to use Azure API Management as a proxy to your BAM API and then use APIM from within Logic Apps.

Serverless360 BAM

Serverless360 is an enterprise product that aims to provide simple yet powerful toolsets for all operational needs in Azure Cloud. Serverless360 offers an end-to-end distributed tracing feature called BAM. BAM helps users identify how a transaction flows in a business process and spotlight failures in those transactions. BAM can be instrumented in your business process by containing services like Logic Apps, Function Apps, APIMs, an On-prem system (capable of making an API call), etc.

Azure API Management Proxy

The standard approach for BAM would look something like the below. There are three main areas:

  • The BAM Service provided by Serverless360
  • Your database and storage where you want to store your BAM data
  • The components which you wish to publish BAM events

Image description

Depending on the hosting option you choose for BAM, you may choose to host the BAM Service yourself or host it on the Serverless360 SaaS platform.

For the scenario we are discussing here, as a BAM user, you might pass your calls to Serverless360 BAM through your own Azure API Management solution before they go to Serverless360. It would look like the below.

Image description

Why might you choose to do this?

There are several different reasons you might consider doing this, which include:

  • You want to centrally route all API calls through APIM for operational and monitoring purposes.
  • You might want to connect APIM to BAM, and you might use the advanced subscription and critical management features in APIM to give other teams access to BAM
  • You might want to have a layer of abstraction from your implementation to a 3rd party service.
  • You might want to simplify your configuration scenarios for logic apps, so you don’t need to use a custom connector.
  • There can be some performance benefits by using APIM rather than a custom connector with Logic Apps.

How do we set up this scenario?

It is easy to set up this scenario. The steps to do this are below.

Download the API Specification for Serverless360 BAM

You need to go to the action menu from the BAM home page and access the BAM connection details.

Image description

You can get the link to the Swagger for your BAM API to view it in swagger UI.

Image description

You can paste the link into the browser, and it will then show you the BAM API.

Image description

The swagger link you need for APIM is shown above with the arrow; you can click it if you want and see the Swagger.

It would help if you took this URL to APIM so you could import your API.

Create BAM API in APIM

Next, go to Azure APIM and start to create a new API using the import Open API option.

Image description

You can then add the URL for the Swagger, which will import information about your BAM API. You probably want to modify the API suffix so it has an extension that matches the pattern for the standard you are using in your APIM.

Image description

Next, click Create, and APIM will import the API and set up BAM for you.

You will now see a new API, as shown below.

Image description

Set the host and key for BAM

Next, you need to set the key for calling your BAM API. The best way to do this is to get the key from the BAM portal, and then in the policy for your All Operations on the API, you can add the header to set the key, as shown below.

Image description

Most people will probably have a named value which will be either a secret or linked to a Key Vault which will be used to set the BAM API key in the policy.

Your APIM is now set up to be able to send messages to BAM.

Use BAM in your Logic App

Next, I will go to my Logic Apps and look to add an APIM action. If you select your APIM instance and the BAM API you created, you will see the list of operations imported when we set up APIM.

Image description

You can now use these operations as we do with the custom connector.

With APIM having all of the schemas for the BAM API, your Logic App will be able to create a rich design-time experience, just like with the custom connector, as shown below.

Image description

The main difference is that instead of creating an API connection behind the scenes and inheriting the additional configuration complexity that Logic Apps have in that area, you inherit the cool features for Logic Apps and APIM. You will be able to do more advanced security scenarios such as managed identity, and you can supply a subscription key and other things depending on how you have set up APIM.

You will also avoid the custom connector throttling limits, so we expect to see a performance improvement here too.

Summary

Hopefully, you will find that choosing to use APIM as a proxy is easy to set up, and it will open some more advanced setup scenarios that some BAM users may find helpful. Choosing the right distributed tracing tool plays a vital role in your business.

Top comments (0)