[英]How to trigger a Azure data factory pipeline with multiple parameter from postman
I have created a Azure Data Factory pipeline which have multiple pipeline parameter,which I need to enter all the time when pipeline trigger.Now I want to trigger this pipeline from postman in my local system and i need to pass parameters to pipeline from post.我已经创建了一个 Azure 数据工厂管道,它有多个管道参数,当管道触发时我需要一直输入。现在我想在我的本地系统中从 postman 触发这个管道,我需要从帖子传递参数到管道。
Do you really need to use postman?你真的需要使用postman吗? I've posted examples of doing this with Powershell and with Python.我已经发布了使用 Powershell 和 Python 执行此操作的示例。
Powershell: How to pass arguments to ADF pipeline using powershell Powershell: 如何使用 powershell 将 arguments 传递到 ADF 管道
Python: https://gist.github.com/Gorgoras/1fe534fd9b454412f81c8203c773c483 Python: https://gist.github.com/Gorgoras/1fe534fd9b454741c488
If your only option is to use the rest api, you can read about it and get some examples here: https://docs.microsoft.com/en-us/azure/data-factory/quickstart-create-data-factory-rest-api如果您唯一的选择是使用 rest api,您可以阅读它并在此处获取一些示例: https://-docs.microsoft-factory/cn-create-us/休息API
Hope this helped!!希望这有帮助!
You can trigger Azure Data Factory via a policy in API Management.您可以通过 API 管理中的策略触发 Azure 数据工厂。
I've added a sample here: https://github.com/Azure/api-management-policy-snippets/blob/master/examples/Trigger%20Azure%20Data%20Factory%20Pipeline%20With%20Parameters.policy.xml我在这里添加了一个示例: https://github.com/Azure/api-management-policy-snippets/blob/master/examples/Trigger%20Azure%20Data%20Factory%20Pipeline%20With%20Parameters.policy.Z0F635D0E0F3874FFF8B581C132ECA77Z
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 script. 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脚本。
Anyway, if someone else stumbles on the same question then here's the solution (which is quite simple).无论如何,如果其他人偶然发现了同样的问题,那么这就是解决方案(这很简单)。
Firstly, Create an Azure App Registration and generate client ID and client secret value.首先,创建一个 Azure App Registration 并生成客户端 ID 和客户端密码值。
Authenticate via REST API to get the Bearer Token通过 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/"'
The response will contain a Bearer token, use it to trigger the pipeline.响应将包含一个 Bearer 令牌,使用它来触发管道。 Replace subscription id, resource group name, and adf name.替换订阅 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"
}'
Note: The app should have contributor access to ADF to trigger the pipeline.注意:应用程序应具有对 ADF 的贡献者访问权限以触发管道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.