【问题标题】:Calling Azure Function from ADF with Route Path Implementation Fails使用路由路径实现从 ADF 调用 Azure 函数失败
【发布时间】:2020-02-22 04:31:07
【问题描述】:

我正在尝试从 ADF 调用 Azure 函数。 Azure Function 已实现如下所示的 Route。

[FunctionName("UpdateStatus_V1")]
public static async Task<IActionResult> Run([HttpTrigger(AuthorizationLevel.Function, "post", Route = "V1/UpdateStatus")] HttpRequest req, ILogger log)

主机文件在 Azure Function 中也有一个 routePrefix

"http": {
  "routePrefix": "DeltaAPI"
}

Function APP上的URI如下所示。

https://functionAPP.azurewebsites.net/DeltaAPI/V1/UpdateStatus?code=secret

当我尝试使用函数活动从 Azure 数据工厂调用此函数时 - 我不断收到此错误

{ 
   "errorCode":"3608",
   "message":"Call to provided Azure function '' failed with status-'NotFound' and message - 'Invoking Azure function failed with HttpStatusCode - NotFound.'.",
   "failureType":"UserError",
   "target":"Azure Function1"
}

我已按照文档 https://docs.microsoft.com/en-us/azure/data-factory/control-flow-azure-function-activity#routing-and-queries 遵循建议,下面给出了 adf 管道代码:

{
  "name": "FunctionTest",
  "properties": {
    "activities": [
      {
        "name": "Azure Function1",
        "type": "AzureFunctionActivity",
        "dependsOn": [],
        "policy": {
          "timeout": "7.00:00:00",
          "retry": 0,
          "retryIntervalInSeconds": 30,
          "secureOutput": false,
          "secureInput": false
        },
        "userProperties": [],
        "typeProperties": {
          "functionName": "V1/UpdateStatus",
          "method": "POST",
          "headers": {
            "Content-Type": "application/json"
          },
          "body": {
            "value": "@json( '{\n \"transactionid\": \"5d283e11e62943ceb2e6e0bb5fe4898f\",\n \"status\": \"Completed\",\n \"Description\": \"\"\n }')",
            "type": "Expression"
          }
        },
        "linkedServiceName": {
          "referenceName": "AzureFunction",
          "type": "LinkedServiceReference"
        }
      }
    ],
    "annotations": []
  }
}

【问题讨论】:

    标签: azure-functions azure-data-factory-2


    【解决方案1】:

    ADF 管道中的 Azure 函数活动期望 Azure 函数返回 JSON 对象而不是 HttpResponseMessage。解决方法如下:https://microsoft-bitools.blogspot.com/2019/01/introducing-azure-function-activity-to.html

    参考 - Error calling the azure function endpoint from azure data factory

    【讨论】:

    • azure 函数的响应按预期以 json 格式返回。如果我使用网络活动,这很好。 ADF 无法使用已实现版本的功能。 ADF 无法根据错误消息识别或访问该功能。
    猜你喜欢
    • 2018-01-15
    • 1970-01-01
    • 1970-01-01
    • 2018-08-17
    • 1970-01-01
    • 2010-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多