繁体   English   中英

如何从 postman 触发具有多个参数的 Azure 数据工厂管道

[英]How to trigger a Azure data factory pipeline with multiple parameter from postman

我已经创建了一个 Azure 数据工厂管道,它有多个管道参数,当管道触发时我需要一直输入。现在我想在我的本地系统中从 postman 触发这个管道,我需要从帖子传递参数到管道。

你真的需要使用postman吗? 我已经发布了使用 Powershell 和 Python 执行此操作的示例。

Powershell: 如何使用 powershell 将 arguments 传递到 ADF 管道

Python: https://gist.github.com/Gorgoras/1fe534fd9b454741c488

如果您唯一的选择是使用 rest api,您可以阅读它并在此处获取一些示例: https://-docs.microsoft-factory/cn-create-us/休息API

希望这有帮助!

Azure Docs doesn't provide examples on how to pass a parameter which I find weird also nowhere else on the internet have I found an example of how to pass multiple parameters via REST API, I guess most people use ADF shell to trigger it or python脚本。

无论如何,如果其他人偶然发现了同样的问题,那么这就是解决方案(这很简单)。

首先,创建一个 Azure App Registration 并生成客户端 ID 和客户端密码值。

通过 REST API 认证得到 Bearer Token

curl --location --request POST 'https://login.microsoftonline.com/${TENANT_ID}/oauth2/token' \
--form 'grant_type="client_credentials"' \
--form 'client_id="${CLIENT_ID}"' \
--form 'client_secret="${CLIENT_SECRET_VALUE}"' \
--form 'resource="https://management.azure.com/"'

响应将包含一个 Bearer 令牌,使用它来触发管道。 替换订阅 ID、资源组名称和 adf 名称。

curl --location --request POST 'https://management.azure.com/subscriptions/${SUBSCRIPTION_ID}/resourceGroups/${RESOURCE_GROUP_NAME}/providers/Microsoft.DataFactory/factories/${ADF_NAME}/pipelines/trigger-pipeline-from-rest/createRun?api-version=2018-06-01' \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "date":"2022-08-22",
    "param1":"param1 value",
    "param2":"some-value"
}'

注意:应用程序应具有对 ADF 的贡献者访问权限以触发管道。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM