RuSs
RuSs

Reputation: 1812

Deploying to Azure API Management with GIT but doing something similar to web.config transformations

I am currently working on deploying AZURE API Management configurations to multiple servers. Like DEV / TEST / PROD for example.

So I can clone my repository using GIT for say my DEV environment. But I might want to push this to TEST using the same "code". I mean, I would not have a TEST specific whole version of the code but 1* code base that I could transform some variables for my TEST deployment.

So a Url would go from this: http://my-DEV-url.com to http://my-TEST-url.com

enter image description here

Now in other worlds like websites, for example, I can transform my web.config using web.test.config. SO depending on my build config my config gets automatically transformed.

So my real question here is, can I do any funky transforms on my Azure API Management json to avoid having to keep 3 versions (DEV/TEST/PROD) of my code in 3 different GIT branches.

Any suggestions will be greatly appreciated.

thanks Russ

Upvotes: 1

Views: 345

Answers (1)

JJ.
JJ.

Reputation: 1149

You can use properties to define instance-scoped values. Properties can't be used to define serviceUrl for an API, but you can use set-backend-service policy to define serviceUrl in runtime.

<policies>
    <inbound>
         <set-backend-service base-url="{{backend-url}}" />
         ....

Then you set "backend-url" property to desired values on your APIM instances. Note that Properties are not exported via git, so all your instances will have different values.

Upvotes: 4

Related Questions