从数据工厂管道触发器调用 azure 函数时出错

Error calling the azure function from data factory pipeline trigger

我正在使用 ADF 函数 activity 在数据工厂管道中调用一个 http 触发的 Azure 函数应用程序。它在调试模式下成功执行,但是当我使用数据工厂触发器发布该管道和 运行 相同代码时,我得到以下错误 -

{
    "errorCode": "3600",
    "message": "Object reference not set to an instance of an object.",
    "failureType": "UserError",
    "target": "AzureFunction"
}

如果我需要进行一些额外的属性更改或者我在这里遗漏了任何内容,请告诉我。当我通过 ADF 中的函数 activity 调用函数应用程序时,还有什么方法可以查看生成的 URL 。

我尝试在 ADF 中使用 Web activity 调用相同功能的应用程序,并且在调试和触发模式下都运行良好。

A​​zure 函数的链接服务代码

{
    "name": "linkedservicesAzureFunctions",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "typeProperties": {
            "functionAppUrl": "https://xyz.azurewebsites.net",
            "functionKey": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "type": "LinkedServiceReference",
                    "referenceName": "linkedservicesKeyVault"
                },
                "secretName": "functions-host-key-default"
            }
        },
        "type": "AzureFunction"
    }
}

Azure 数据工厂中存在一个已知错误,他们正在解决这个问题。现在,如果您使用 .NET SDK 创建 Azure 数据工厂,那么您需要在 Azure Function Activity.

中像这样设置 Headers
new AzureFunctionActivity
                {
                    Name = "CopyFromBlobToSnowFlake",
                    LinkedServiceName = new LinkedServiceReference(pipelineStructure.AzureFunctionLinkedService),
                    Method = "POST",
                    Body = body,
                    FunctionName = "LoadBlobsIntoSnowFlake",
                    Headers = new Dictionary<string, string>{ },
                    DependsOn = new List<ActivityDependency>
                    {
                        new ActivityDependency{
                            Activity = "CopyFromOPSqlServerToBlob",
                            DependencyConditions= new List<string>{"Succeeded" }
                        }
                    }
                }

如果您正在通过 UI 创建 Azure 函数 Activity,则只需更新 Activity 的描述,然后发布,Headers 将自动初始化。