Discover Azure API Management APIs in Catalog with the Konnect API

TL;DR

Install the Azure API Management integration in Konnect and authorize access with OAuth, then link an Azure API to your Catalog service.

Prerequisites

If you don’t have a Konnect account, you can get started quickly with our onboarding wizard.

  1. The following Konnect items are required to complete this tutorial:
    • Personal access token (PAT): Create a new personal access token by opening the Konnect PAT page and selecting Generate Token.
  2. Set the personal access token as an environment variable:

    export KONNECT_TOKEN='YOUR KONNECT TOKEN'
    

You need the Integration Admin role in Konnect to install and authorize Catalog integrations.

Configure the Azure API Management integration

Note: The Azure API Management integration uses OAuth for authentication and can only be configured through the Konnect UI.

Before you can discover APIs in Catalog, you must configure the Azure API Management integration.

  1. In the Konnect sidebar, click Catalog.
  2. In the Catalog sidebar, click Integrations.
  3. Click Azure API Management.
  4. Click Add Azure API Management instance.
  5. In the Subscription ID field, enter your Azure API subscription ID.
  6. Click Submit configuration.
  7. In the Add authorization section, click Authorize in Azure API Management.
  8. Click Authorize to authenticate with Azure using OAuth.
  9. In the Azure authorization window, click Accept.
  10. In the Display name field, enter azure-api-management-test.
  11. In the Instance name field, enter azure-api-management-test.
  12. Click Save.

Create a service in Catalog

Create a service that you’ll map to your Azure API Management resources:

curl -X POST "https://us.api.konghq.com/v1/catalog-services" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "name": "billing",
       "display_name": "Billing Service"
     }'

Export the service ID:

export AZURE_SERVICE_ID='YOUR-SERVICE-ID'

List Azure API Management resources

Before you can map your Azure API Management resources to a service in Catalog, you first need to find the resources that are pulled in from Azure API Management:

curl -X GET "https://us.api.konghq.com/v1/resources?filter%5Bintegration.name%5D=azure-api-management" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN"

You might need to manually sync your Azure API Management integration for resources to appear. In the Konnect UI, by navigate to the Azure API Management integration you just installed and select Sync Now from the Actions dropdown menu.

Export the resource ID you want to map to the service:

export AZURE_RESOURCE_ID='YOUR-RESOURCE-ID'

Map resources to a service

Now, you can map the Azure API Management resource to the service:

curl -X POST "https://us.api.konghq.com/v1/resource-mappings" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN" \
     --json '{
       "service": "billing",
       "resource": "'$AZURE_RESOURCE_ID'"
     }'

Validate the mapping

To confirm that the Azure API Management resource is now mapped to the intended service, list the service’s mapped resources:

curl -X GET "https://us.api.konghq.com/v1/catalog-services/$AZURE_SERVICE_ID/resources" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN"
Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!