Site icon TheWindowsUpdate.com

Configure API Management with Management API

This post has been republished via RSS; it originally appeared at: New blog articles in Microsoft Tech Community.

Background Information:

Users often use the Azure portal to set, change or remove the configurations of API Management. For instance, we import APIs, create products, configure the log analytics, etc.

The whole picture of entire traffic about those operations is:

User -> Azure Resource Manager -> API Management Control Plane (Resource Provider) -> Management API (Management Endpoint of API Management Service)

 

User -> Management API (Management Endpoint of API Management Service)

 

Common Scenario:

When import large API definition, Azure resource manager has 2mins of timeout, however, it may need over 2 mins to wait for API Management finishing the API importing.  Therefore, Azure Resource Manager returned 409 error due to the timeout.

In this Scenario, we can call the Management API directly to avoid the similar issue happen.

 

Prerequisites:

Enable the Management API from Azure portal for your API Management Service and generate the SAS token for authentication via API Management REST | Microsoft Docs:

 

The screen shows the base URL of the Management API, expire date. Then we should generate an Access Token for future use.

Steps:

For instance, we want to list all the API details of an API management Service:

  1. Find the REST API call as your business requirement from Azure API Management REST API | Microsoft Docs

 

Noted: This document’s REST APIs are following the Client -> Azure Resource Manager -> Control Plane -> APIM service, we need to change the endpoint afterwards to bypass the Azure Resource Manager.

 

Steps for getting the target REST API:

 

  1. Copy and paste the URL into Postman, the URL should be like

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis?api-version=2021-08-01 

  1. Change the management.azure.com into {servicename}.management.azure-api.net:3443, since API Management needs to talk to the service via 3443 port:

After that, the URL should be like:

GET

https:// {servicename}.management.azure-api.net:3443 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis?api-version=2021-08-01

  1. Then in the Authorization Header, we need to add the SAS token generated from the Prerequisites part as the value:

 

  1. Then we can use the Postman to send the request, the response should be like:

 

Exit mobile version