Azure API Management Self Hosted Gateway Automation

Rasmikant Bal 66 Reputation points

I have API Management service with Self Hosted Gateway deployed in on Premise (RHEL OS) DOCKER to communicate with On Premise APIs.

  1. what's the best way automate copy the env.config file to on premise docker environment & execute following command ? docker run -d -p 80:8080 -p 443:8081 --name <gateway-name> --env-file env.conf<tag>
  2. The access token given for the self-hosted gateway is only valid for 30 days. How to regenerate the access token automatically for DOCKER ? Is it something we need do in Azure or something need to be done On Premise System. Which option is best ?
Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,084 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaran Murugaachari 6,086 Reputation points Microsoft Employee

    @Rasmikant Bal I assume you have already configured Docker, and APIs and looking for options to automate self-hosted gateway steps described in Deploy an Azure API Management self-hosted gateway to Docker. Unfortunately, we don't have any guidelines/doc or tools specifically on automating this process.

    My suggestion is to explore more on tools such as Azure Pipelines or GitHub Actions. Let's take Azure Pipelines as an example. I am not a DevOps expert and from the docs, I see you can Invoke REST API v1 task for calling Rest APIs and Docker v2 task for running docker command.

    To generate access token for Self-Hosted Gateway, first you need to set up App registration in Azure AD with client credential flow (refer doc), generate token from AD endpoint to access APIM endpoint and then call Gateway - Generate Token Rest API with AD token. Then depends on how docker container authentication/authorization is set up, you can manage access to Docker via pipeline and call Docker task to deploy self-hosted gateway.

    For any questions specific to DevOps, please feel free to reach out to dedicated forum [ (DevOps is not yet supported in Q&A) for assistance.

    Please let me know if I can help you with any other questions.