azure - 外部 api 管理服务无法解析 Azure 函数服务名称

标签 azure azure-functions azure-api-management

目前,我正在尝试使用 Api 管理来公开 vnet 内的 Azure Function http 触发器。

设置完所有内容后,我尝试了一个简单的 GET 请求,但收到了 500 错误消息

    "messages": [
        "Error occured while calling backend service.",
        "The remote name could not be resolved: '<function-name>.azurewebsites.net'"
    ]

我的 Azure 功能是:

  1. 采用高级套餐创建。
  2. 通过专用端点启用入站流量。
  3. 与我的 API 管理服务部署在同一 Vnet 中。
  4. 从门户添加了 httpTrigger 模板
  5. 设置了 Azure 托管 DNS 名称

我的 API 管理服务是在外部模式下创建的,我将我的函数链接到门户中的 Api 管理。

我尝试过的事情:

  • 我已仔细检查是否已打开正确的安全组规则以使 API 管理正常工作
  • 我已确保我的 API 管理(外部)与我的无服务器功能位于同一 vnet 中
  • 我将虚拟机部署到同一虚拟网络,但无法解析那里的函数的 DNS 名称。使用 ping、telnet、nslookup。
  • 尝试将应用程序设置添加到我的函数中以指定 azure dns 服务器以及其他设置。
  • 我已检查我的私有(private) DNS 区域是否已与我的 vnet 链接。

似乎是 DNS 名称解析问题,但我似乎无法修复它。关于可能导致此错误的原因有什么想法吗?

更新

所以这似乎是我的专用端点的问题。我创建的每个函数在没有函数的情况下都可以正常工作,但我仍然希望拥有专用端点,这样就无法从互联网访问它。

我知道我可能可以将我的函数锁定为仅从 api 管理网关 IP 调用,但如果我没有的话,我宁愿不必硬编码 IP。

最佳答案

谢谢MayankBargali-MSFT | Microsoft Docs将您的建议作为答案发布以帮助其他社区成员。

As per the error, the APIM is not able to resolve your azure function app. Can you please verify if the custom DNS is correctly setup and you can refer to this document for more details. Outbound access on port 53 is required for communication with DNS servers. If a custom DNS server exists on the other end of a VPN gateway, the DNS server must be reachable from the subnet hosting API Management. I will also suggest you to review this document for the setup part.

引用:External api management service can't resolve Azure function service name - Microsoft Q&A

关于azure - 外部 api 管理服务无法解析 Azure 函数服务名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71260827/

相关文章:

azure - 在 Azure Functions 中,我可以将 C# HttpTrigger 与 Python HttpTrigger 结合起来吗

azure - 在 Azure 中观看多个 IRC channel 的最佳方式

始终在线应用服务计划上的 Azure Function 超时且未设置 functionTimeout

Azure - PowerShell 如何在重新连接后恢复/重新设置变量值

Azure API管理Rest api获取所有订阅 key 抛出400错误代码

azure - 用户是否可以在不登录 Microsoft 的情况下使用 Azure B2C 进行身份验证

azure - 通过 vnet 对等路由互联网流量

.net - 使用 .NET 5 和 Docker 创建 Azure Functions

azure - 在 Azure API 管理入站策略部分获取路由参数

node.js - 使用 node.js 在特定延迟后从 Azure ServiceBus 主题发送消息