@Prem Jha I would like to share an example that I have tested and its steps.
- Created an apim service using ARM template https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.apimanagement/api-management-create-all-resources and deployed it using portal (or CLI as well)
- Then cloned GIT repository https://github.com/Azure/azure-api-management-devops-resource-kit in my local machine.
- Restored packages using dotnet restore and set subscription using Azure CLI as mentioned in docs: https://github.com/Azure/azure-api-management-devops-resource-kit/blob/main/src/README.md#extractor
- Ran "dotnet run extract --sourceApimName <apim service name> --destinationApimName <apim service name> --resourceGroup <my resourcegroup> --fileFolder c:\temp\apim-extract --apiName exampleApi" to extract ARM template for exampleAPI.
- Reviewed ARM template generated for exampleAPI in "C:\temp\apim-extract\<apim service name>-exampleApi-api.template.json" and then updated ARM template for my need.
- Then deployed the template successfully using az deployment group create (refer docs: https://learn.microsoft.com/en-us/cli/azure/deployment/group?view=azure-cli-latest#az-deployment-group-create)
(example: az deployment group create --name SampleUpdate --resource-group <my resourcegroup> --template-file "C:\temp\apim-extract\<apim service name>-exampleApi-api.template.json" --parameters "C:\temp\apim-extract\<apim service name>-parameters.json")
I hope these steps help with your question and feel free to add if you have any questions on CI/CD pipeline configuration. I would be happy to assist you.
Azure API Management DevOps Resource Kit
Use DevOps and CI/CD to publish APIs
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.
i have tried updating the template in complete deployment mode but it is saying that complete mode is not supported in nested templates. and i am confused on how to use extractor in setting up of ci/cd. if you can help me with these two scenarios that would be so great !!
@Prem Jha Sorry for the delay in response (OOF for the last few days). For nested templates, this is expected, and you can set only as Incremental. Refer to Linked Template docs, about this scenario but you can deploy the main template in Complete mode. Can you let me know how did you update ARM template? I recommend you use Extractor tool (https://github.com/Azure/azure-api-management-devops-resource-kit/blob/main/src/README.md#extractor) to import the existing API details and then update the template.
The Extractor link has the below instructions to clone the repository and have examples to extract all APIs or specific API. Then you can make the changes to the template. Once the changes are made, you can then deploy it. Can you please elaborate more for any questions on Extractor tool (if related to importing)? Or configuring CI/CD pipeline specifically? If so, please share the details about the pipeline that would help me understand better.