错误"BadRequest"在ADF中调用Azure函数时 [英] Error "BadRequest" when calling Azure Function in ADF

查看:97
本文介绍了错误"BadRequest"在ADF中调用Azure函数时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个广泛的数据工厂工作流程,该流程将自动创建并填充多个客户的数据仓库,但是我遇到了错误.我将首先发布问题,因为剩余信息有点长.请记住,我是数据工厂和JSON编码的新手.

I am creating an extensive data factory work flow that will create and fill a data warehouse for multiple customers automatic, however i'm running into an error. I am going to post the questions first, since the remaining info is a bit long. Keep in mind i'm new to data factory and JSON coding.

问题与解答;评论

  • 如何正确将参数传递给执行管道"活动?
  • 如何将上述参数添加到Azure Function活动中?

问题可能在于正确地传递了参数,也可能在于拾取参数-我似乎无法确定哪个参数.如果您发现当前设置有错误,请随时告诉我-感谢所有帮助

The issue may lie with correctly passing the parameter through, or it may lie in picking it up - i can't seem to determine which one. If you spot an error with the current setup, dont hesitate to let me know - all help is appreciated

错误

{
"errorCode": "BadRequest",
"message": "Operation on target FetchEntries failed: Call to provided Azure function
'' failed with status-'BadRequest' and message -
'{\"Message\":\"Please pass 'customerId' on the query string or in the request body\"}'.",
"failureType": "UserError",
"target": "ExecuteFullLoad"
}

设置:

整个设置从一个函数调用开始,以从在线经济平台吸引新客户.它将它们写入SQL表,从中对其进行处理并加载到最终表中,然后执行新的管道.这个过程非常完美.从那里执行以下管道:

The whole setup starts with a function call to get new customers from an online economic platform. It the writes them to a SQL table, from which they are processed and loaded into the final table, after which a new pipeline is executed. This process works perfectly. From there the following pipeline is executed:

如您所见,在ForEach循环尝试执行另一个管道之前,所有方法都运行良好,该管道包含一个Azure函数,该函数调用填充该仓库的.NET脚本函数(我知道这很复杂).这个天蓝色的函数需要一个customerid来检索令牌并将数据加载到仓库中.我试图将这些标记从InternalCustomerID查找通过ForEach传递到管道和函数中. ForEach实际上有效,但是因为内部活动失败" .

As you can see it all works well until the ForEach loop tries to execute another pipeline, that contains an azure function that calls a .NET scripted function that fills said warehouse (complex i know). This azure function needs a customerid to retrieve tokens and load the data into the warehouse. I'm trying to pass those tokens from the InternalCustomerID lookup through the ForEach into the pipeline and into the function. The ForEach works actually, but fails "Because an inner activity failed".

执行管道"任务包含以下设置,在这里我试图传递来自foreach循环的参数.该过程的这一部分也起作用,因为它执行了两次(在此测试阶段应该如此):

The Execute Pipeline task contains the following settings, where i'm trying to pass the parameter through which comes from the foreach loop. This part of the process also works, since it executes twice (as it should in this test phase):

我不知道它是否无法成功传递参数,或者无法将其添加到azure函数的主体中.

I dont know if it doesn't successfully pass the parameter through or it fails at adding it to the body of the azure function.

子管道(FullLoad)包含以下参数.我不确定是否应将默认值设置为覆盖或它实际如何工作.我在互联网上看到的指南还没有默认值.

The child pipeline (FullLoad) contains the following parameters. I'm not sure if i should set a default value to be overwritten or how that actually works. The guides i've look at on the internet havent had a default value.

最后是Azure功能的设置.我不确定为正确捕获参数和/或填写内容而需要写的内容-如果是有关错误消息的标头或正文.我知道如果没有尸体就无法执行职务.

Finally there is the settings for the Azure function. I'm not sure what i need to write in order to correctly capture the parameter and/or what to fill in - if it's the header or the body regarding the error message. I know a post cannot be executed without a body.

如果我手动运行此特定功能(使用portal.azure.com的Function App部分),则可以通过使用以下设置来正常运行:

If i run this specific funtion by hand (using the Function App part of portal.azure.com) it works fine, by using the following settings:

推荐答案

我查看了您所有的详细问题,我认为问题的关键是Azure Function Request Body的格式.

I viewed all of your detailed question and I think the key of the issue is the format of Azure Function Request Body.

恐怕这是不正确的.请根据您的描述查看我的以下步骤:

I'm afraid this is incorrect. Please see my below steps based on your description:

工作流程:

在ForEach活动中,只有一个Azure Function活动:

Inside ForEach Activity, only one Azure Function Activity:

LookUp活动的预览数据:

The preview data of LookUp Activity:

然后配置ForEach活动:@activity('Lookup1').output.value

Then the configuration of ForEach Activity: @activity('Lookup1').output.value

Azure功能活动的配置:@json(concat('{"name":"',item().name,'"}'))

The configuration of Azure Function Activity: @json(concat('{"name":"',item().name,'"}'))

从azure函数中,我仅输出输入数据.输出示例如下:

From the azure function, I only output the input data. Sample Output as below:

提示: :我看到您的步骤是在另一个管道中执行azure函数并使用执行管道活动",(我不知道为什么您必须遵循这样的步骤) ,但我认为这没关系,因为您只需要关注Body格式,如果可接受的格式是JSON,则可以使用@json(....),如果可接受的格式是String,则可以使用@cancat(....).此外,您可以从使用pipeline().parameters

Tips: I saw your step is executing azure function in another pipeline and using Execute Pipeline Activity, (I don't know why you have to follow such steps), but I think it doesn't matter because you only need to focus on the Body format, if your acceptable format is JSON, you could use @json(....),if the acceptable format is String, you could use @cancat(....). Besides, you could check the sample from the ADF UI portal which uses pipeline().parameters

这篇关于错误"BadRequest"在ADF中调用Azure函数时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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