Azure API管理和App Function后端: Backend with id 'foo' could not be found

标签 azure terraform azure-api-management azure-function-app

在我的公司,我们的应用程序有相同的环境:IT、ST、AT 和 PRD。我们使用 Terraform 来部署 Azure 资源,目前正在尝试设置一个 API 管理解决方案,将调用传递到 Function App 后端。

设置相当简单,我们声明了一系列 API,并在其后端策略中声明了这一点:

<policies>
  <inbound>
    <set-backend-service id="apim-generated-policy" backend-id="function-at" />
  </inbound>
</policies>

在 IT/ST 中,我们已经能够成功设置这一点。但是,当我们的 Terraform 管道在 AT 上运行时,它总是无法更新我们的 API,并出现以下错误:

Error: Error creating or updating API Operation Policy (Resource Group "rg-at" / API Management Service "api-at" / API "call" / Operation "get-call"):
apimanagement.APIOperationPolicyClient#CreateOrUpdate: Failure responding to request:
StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="ValidationError" Message="One or more fields contain incorrect values:" Details=[{"code":"ValidationError","message":"Error in element 'set-backend-service' on line 3, column 6: Backend with id 'function-at' could not be found.","target":"set-backend-service"}]

尝试在 Azure UI 中手动添加此行时,会发生相同的错误:

Error in element 'set-backend-service' on line 3, column 10:
Backend with id 'function-at' could not be found.

我不明白为什么这不起作用。该函数存在并且与 API 管理器位于同一资源组中。我最好的猜测是,有人在其他环境中手动更改了设置,但没有反射(reflect)在 Terraform 代码中。我该如何解决此问题?我对 ST 和 AT API/函数进行了并排比较,没有发现任何明显的差异。

预先感谢您的帮助!

最佳答案

我在 Terraform 部署期间遇到了同样的问题,对我来说,解决方案是添加 api_management_backend在政策上我可以引用它。

关于Azure API管理和App Function后端: Backend with id 'foo' could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58879254/

相关文章:

Azure 异地复制非常适合减少更新期间的停机时间

c# - 如何知道应用程序洞察遥测客户端是否正常运行?

azure - Terraform Plan 在 Windows 上为列表变量传递值

azure - 导出/导入 Azure API 管理开发人员门户 UI 更改

rest - 使用 REST API 的 Azure API 管理的通知列表

Azure 二头肌存储帐户循环 blob 错误

azure - 如何在 Azure Devops 中以正确的方式进行基于功能的部署?

Terraform 无效参数组合 : DB Security Groups can only be associated with VPC DB Instances

azure - 使用 terraform 设置 functionTimeout

azure-api-management - 将出站策略应用于 Azure API 管理中的模拟操作