user3180997
user3180997

Reputation: 1926

Azure Bicep - Connect Azure API Management (API) to Azure Function App

I can see within the Azure Management Console, specifically within the Azure API Management Service, via the GUI you are able to use Azure Functions to form an API.

I am trying to implement the same via Azure Bicep, but I do not see any options in the Bicep documentation for API Management - API Service.

In the GUI, I see something like this:

Azure API GUI - Connect to Azure Function

This allows me to specify my Function App:

Pick Azure Functions App

However, within the Bicep Documentation, I don't see anything where I would expect to: Microsoft.ApiManagement service/apis

I have instead tried using the Microsoft.ApiManagement service/backends but that doesn't give the same experience and I haven't managed to get that to work.

So my question is, how do I connect my Azure API Management service to an Azure Site (app) which is set as a suite of Azure Functions?

Upvotes: 1

Views: 1528

Answers (2)

Zapadoody
Zapadoody

Reputation: 11

I added OpenAPI specifications to my functionApps to produce the sawgger \ -openAPI link (or file). Then leveraged the OpenAPI file to build the APIs.


// Create APIM Service

resource apimServiceRes 'Microsoft.ApiManagement/service@2021-08-01' = {
  name: 'apim service name'
  location: resourceGroup().location
  sku:{
    capacity: 0
    name: 'select a sku'
  }
  identity:{
    type: 'SystemAssigned'
  }
  properties:{
    publisherName: 'your info'
    publisherEmail: 'your info'
  }
}

// Create the API Operations with:

resource apimApisRes 'Microsoft.ApiManagement/service/apis@2021-08-01' = {
  name: '${apimServiceRes.name}/name-to-represent-your-api-set'
  properties: {
    format: 'openapi-link'
    value: 'https://link to your swagger file'
    path: ''
  }
}

Upvotes: 1

Miq
Miq

Reputation: 4289

You need to create backend and all api definitions manually. The portal gives you a nice creator and does all those REST calls for you. With bicep (and ARM) which is operating directly on the REST endpoints of each resource provider you need to build own solution.

Perhaps there’re somewhere some existing templates that can do this but personally I didn’t see any yet.

Upvotes: 2

Related Questions