【问题标题】:Azure Bicep - Connect Azure API Management (API) to Azure Function AppAzure 二头肌 - 将 Azure API 管理 (API) 连接到 Azure Function App
【发布时间】:2022-02-25 05:40:57
【问题描述】:
【问题讨论】:
标签:
azure
azure-functions
azure-api-management
azure-bicep
【解决方案1】:
您需要手动创建后端和所有 api 定义。该门户为您提供了一个很好的创建者,并为您完成所有这些 REST 调用。使用直接在每个资源提供者的 REST 端点上运行的二头肌(和 ARM),您需要构建自己的解决方案。
也许有一些现有的模板可以做到这一点,但我个人还没有看到。
【解决方案2】:
我将 OpenAPI 规范添加到我的 functionApps 以生成锯齿机 \ -openAPI 链接(或文件)。然后利用 OpenAPI 文件构建 API。
// 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: ''
}
}