In my azure devops pipeline i have a task AzureCLI@2 that deploys an api to apim. How can i use the same task using the az apim api to update the api? I know that there is an operation to do this but the documentantion don't show how to and i didn't find any example. I'm using an open api file generated in the pipeline to create and i would like to use it to update the api either.
Just use az apim api import again. It will replace existing API with new one, preserving policies for operations with the same template. --path and --api-id parameters must be the same as existing API. Provide url/path to the swagger/openapi and correct specification format. Example:
az apim api import --path "/myapi" --api-id "myapiid" --resource-group "test-rg" --service-name "test-apim" --specification-url "https://petstore.swagger.io/v2/swagger.json" --specification-format Swagger
If you want to add revision instead of updating existing one, add additional --api-revision parameter
az apim api update is suited for updating single properties or fields like description, api type etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With