I am trying to connect Azure Function App (which have a Spring Boot application inside it) with the Azure API Management. I am able to do this using Azure UI.
But when I try this using Azure Bicep I have to manually specify all the apis that I want to show in APIM.
param location string = resourceGroup().location
resource bicep_poc 'Microsoft.ApiManagement/service@2022-09-01-preview' = {
name: 'bicep-poc'
location: location
sku: {
name: 'Consumption'
capacity: 0
}
identity: {
type: 'SystemAssigned'
}
properties: {
publisherEmail: 'abc@xyz.com'
publisherName: 'abcd'
}
}
// send apis
resource bicep_poc_bicep_fa_demo 'Microsoft.ApiManagement/service/apis@2022-09-01-preview' = {
parent: bicep_poc
name: 'bicep-fa-demo'
properties: {
displayName: 'bicep-fa-demo api function'
apiRevision: '1'
description: 'Import from "bicep-fa-demo" Function App'
subscriptionRequired: false
path: 'bicep-fa-demo/hello_1a'
protocols: [
'https'
]
isCurrent: true
}
}
resource bicep_poc_bicep_fa_demo_get_hello_world 'Microsoft.ApiManagement/service/apis/operations@2022-09-01-preview' = {
parent: bicep_poc_bicep_fa_demo
name: 'get-hello-world'
properties: {
displayName: 'hello-world'
method: 'GET'
urlTemplate: '/hello-world'
templateParameters: []
responses: []
}
}
resource bicep_poc_bicep_fa_demo_get_hello_world_policy 'Microsoft.ApiManagement/service/apis/operations/policies@2022-09-01-preview' = {
parent: bicep_poc_bicep_fa_demo_get_hello_world
name: 'policy'
properties: {
value: '<policies>\r\n <inbound>\r\n <base />\r\n <set-backend-service id="apim-generated-policy" backend-id="bicep-fa-demo" />\r\n </inbound>\r\n <backend>\r\n <base />\r\n </backend>\r\n <outbound>\r\n <base />\r\n </outbound>\r\n <on-error>\r\n <base />\r\n </on-error>\r\n</policies>'
format: 'xml'
}
}
Here I need to manually add Microsoft.ApiManagement/service/apis/operations
.
Is there any direct way to do so like UI does just by connecting lambda it creates all the apis for Http Triggers and connect it to backend (which is function app here)?