如何通过 Azure create 运行 pipelines API 触发管道?

How to trigger pipeline by Azure create run pipelines API?

我有一个 Azure 数据工厂订阅,我想通过我的 node.js 应用程序触发管道。管道将数据从 azure cosmos 传输到 Azure blob 存储。我已经手动触发了一次管道。我试图对 node.js 应用程序执行相同的操作,但它引发了以下错误:

{ Error: tunneling socket could not be established, cause=connect ETIMEDOUT 10.0.0.2:8080
    at ClientRequest.onError (/home/deepti/Desktop/dbmanager/node_modules/tunnel-agent/index.js:177:17)
    at Object.onceWrapper (events.js:286:20)
    at ClientRequest.emit (events.js:198:13)
    at Socket.socketErrorListener (_http_client.js:392:9)
    at Socket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19) code: 'ECONNRESET' }

这是我在 node.js 应用程序中的代码:

Request.post("POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelines/{pipelineName}/createRun?api-version=2018-06-01",(err,res,body)=>{
        if(err) {
            return console.log(err);
        }
        console.dir(JSON.parse(body));
        });

任何人都可以指导我如何纠正此错误并继续进行。我是否也需要生成一些授权令牌?

此外,我实际上想将 1 个月前的数据从 cosmos DB 备份到 Azure Blob,这可能吗?

1.Can anyone please guide me how do I rectify this error and proceed further. Do I need to generate some authorization token too?

是的,在创建管道 运行 之前,您需要在 Headers 中生成授权令牌。可以参考ADAL nodejs sdk生成token。如果你不知道这些参数是什么:

,那么请参考这个tutorial and this blog来了解它们的概念。 请注意,您还需要向您的广告应用授予 ADF 权限。

最后,您可以调用 Pipelines - Create Run REST api 并在 header.

中提供身份验证令牌

2.Also, I actually want to back up data that is 1 month old from cosmos DB to Azure Blob, is that possible?

如果你想备份azure blob存储数据,请参考这个link。你可以在计划中使用AzCopy在阶段备份数据。