Azure API 管理和 App Function 后端:找不到 ID 为“foo"的后端 [英] Azure API management and App Function backend: Backend with id 'foo' could not be found

查看:18
本文介绍了Azure API 管理和 App Function 后端:找不到 ID 为“foo"的后端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my company we have identical environments for our application: IT, ST, AT and PRD. We use Terraform to deploy our Azure resources, and are currently attempting to set up an API management solution which passes calls to a Function App backend.

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

The set up is fairly simple, we have a series of APIs declared, and in their backend policies we declare this bit:

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

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

In IT/ST we have been able to set this successfully. However, when our Terraform pipeline runs on AT, it always fails to update our APIs with this error:

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 中手动添加此行时,会出现同样的错误:

When attempting to add this line manually in the Azure UI, the same error occurs:

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

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

I cannot understand why this refuses to work. The function exists and is in the same resource group as the API manager. My best guess is that someone has changed a setting manually in the other environments that is not reflected in the Terraform code. How can I go about troubleshooting this issue? I did a side-by-side comparison of the ST and AT APIs/functions and did not find any obvious differences.

提前感谢您的帮助!

推荐答案

我在 Terraform 部署过程中遇到了同样的问题,对我来说解决方案是添加 api_management_backend 并且在政策中我能够参考它.

I faced the same problem during Terraform deployment and for me solution was to add api_management_backend and in policy I was able reference to it.

这篇关于Azure API 管理和 App Function 后端:找不到 ID 为“foo"的后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆