Search code examples
azure-api-managementazure-bicep

Azure APIM: How can I link an existing API to a new product using Bicep?


I have a product on my Azure Api Management Service

resource myapi_product 'Microsoft.ApiManagement/service/products@2020-12-01' = {
  parent: apiManagement
  name: 'the-name-of-the-product'
  properties: {
    displayName: 'displayname'
    description: 'description'
    subscriptionRequired: true
    approvalRequired: false
    state: 'published'
  }
}

How can I link an existing api (added to APIM) and add it to this product using bicep? Like I would by using add in the GUI enter image description here


Solution

  • You can look up the Bicep resource definition here: Microsoft.ApiManagement/service/products/apis

    resource symbolicname 'Microsoft.ApiManagement/service/products/apis@2023-05-01-preview' = {
      name: 'the-name-of-the-api'
      parent: myapi_product
    }