简体   繁体   中英

ARM/Bicep template for importing API Management operations

I'm putting the final pieces together on deploying a bunch of APIs through API Management.

I have a number of App and Logic App backends that are combined in API Management. Reverse engineering an ARM template from the portal suggests I have to write out each and every operation by hand to create the operations vi Bicep.

Is there a way, that like the portal, I can instruct ARM to use the OpenAPI specification generated automatically by the backend Apps and Logic Apps to automatically populate the operations?

Given the variety of operational paths, I feel like I'm going to be here all week typing them out as the variance is too much to have a loop.

Here is an example on how I used OpenAPI for populating APIM Gateway. I passed the OpenAPI spec converted to single line into the Value field and set the format field to openapi+json. Here is an example

resource ImportedOpenapi 'Microsoft.ApiManagement/service/apis@2021-12-01-preview' = {
  parent: apimservicesymbolicname 
  name: 'ImportOpenApi'
  properties: {
    name: 'MyTestAPI'
    apiType: 'http'
    contact: {
      email: 'xyz@abc.com'
      name: 'test'
    }
    format: 'openapi+json'
    path: 'myapi'
    protocols: [
      'https'
    ]
    isCurrent: true
    subscriptionRequired: true
    type: 'http'
    value: '{"openapi":"3.0.1","info":{"title":"MyApi","contact":{},"version":"1.0"},"servers":[{"url":"https://xyz.api"}],"paths":...'
    }
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM