I need to deploy an API to APIM, update its revision and make it current. I am looking for best practices to do this (i.e., updating an api), and to achieve it using Azure DevOps. Also, I have below questions,
- My backing API service (Azure function) is a .Net application that has OpenAPI Specification defined using
Microsoft.Azure.WebJobs.Extensions.OpenApi
. The versioning of the API is defined usingOpenApiInfo.Version
attribute. For updating the specification i am using Bicep shown below,
resource api 'Microsoft.ApiManagement/service/apis@2022-09-01-preview' = { parent: apimInstance name: '${apiName};rev=${apiRevision}' properties: { displayName: apiDisplayName apiType: 'http' format: 'openapi+json-link' value: 'https://$(FunctionAppName).azurewebsites.net/api/swagger.json' path: apiUrlSuffix protocols: [ 'https' ] subscriptionRequired: true // isCurrent: makeCurrent apiVersionSetId: apiVersionSet.id apiVersion: apiVersionValue apiRevision: apiRevisionValue } }
Question: Can't the bicep (ARM) use the version information defined in the swagger.json file? Currently, I am explicitly passing apiVersionValue.
- In the above bicep, uncommenting the isCurrent results in failure of pipeline with "Cannot update revision ..." error. How to update the apiRevision and set it to current?