Search code examples
azureenvironmentazure-api-management

Azure APIM Setting multiple environment in one instance


Currently I have created an Azure APIM Instance and the URL looks as below.

https://abc-test.azure-api.net

I want to use this APIM instance to Support Dev and QA environment. So I want to setup URL like below

https://abc-test.azure-api.net/dev/API/User/1

https://abc-test.azure-api.net/qa/API/User/1

So based on the environment variable, I will set the back end URL. Setting the back end URL is straight forward. But constructing above APIM URL is where I am not sure.


Solution

  • That would require registering API anew for every environment since the part right after hostname is API URL suffix and cannot be templetized. Alternatively you could have every operation in every API start with {env} URL template variable and pivot of that variable in policy to make a distinction. BUt that would make your URL look like https://abc-test.azure-api.net/API/dev/User/1 and will have you to have some env value for prod as well.