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

查看:140
本文介绍了Azure API管理和应用功能后端:找不到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.

在此先感谢您的帮助!

推荐答案

在解决了这一问题几天后,看来问题在于使用后端,该后端需要为首先声明,以便API管理器将其视为可用。我无法在UI的任何地方找到可以查看或编辑这些可用后端的位置,但是基于(非常稀疏的)描述此处

After messing around with this issue for some days, it appears the problems is that to use a backend, this backend needs to be declared first so that the API manager views it as available. I was not able to find anywhere in the UI where these "available" backends can be viewed or edited, but I reached this conclusion based on the (very sparse) description here.

当通过UI手动添加API时,该过程似乎也是自动完成的。但是,当尝试使用Terraform进行操作时情况并非如此,因此看来正确的过程是首先使用Powershell发布后端,然后尝试使用TF将其添加到API。

It also seems like this process is done automatically when adding an API manually through the UI. This however is not the case when trying to do it with Terraform, so it appears the correct procedure would be to first publish the backend with Powershell, and then try to add it to the API with TF.

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

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