I'm looking for a straightforward and maintanable way to set up a CI/CD pipeline for Azure API Management.
Let's say, for each release, I can automatically generate the OpenAPI spec from the code. How can I build on this OpenApi spec to set up Azure API Management with all required version sets, apis, products, tags, users, subscriptions, certificates, and policies?
I've found Azure DevOps toolkit but it has bugs, does not provide all features, and is not easy and flexible enough to be integrated with CI/CD pipeline.
There is a less well-known cross-platform tool called dotnet-apim.
It's forked from Microsoft's Apim DevOps Toolkit but there are added many other functionalities such as:
On top of all these benefits, the toolkit is now packaged as a cross platform dotnet global tool. So, you can easily add a task in your ci/cd pipeline to install dotnet and dotnet-apim in one shot. Then you can easily call the tool to generate required ARM templates for you.
dotnet tool install --global Apim.DevOps.Toolkit #installs the tool
dotnet-apim -c "c:/apim/definition.yml" #generates arm templates
The tool's Github page provides a detailed explanation. Examples are also included to illustrate different scenarios.
The Variables and Conditional Statements provide a lot of flexibility to support complex scenarios.