简体   繁体   中英

How to bind a trigger to an Azure Datafactory Pipeline via Azure CLI?

I'm trying to automatize the creation of azure datafactory pipelines with a script. I'm able to create the pipeline and the trigger with az datafactory pipeline create and az datafactory trigger create .

The problem is that I was not able to find a way to bind those two in the AZ CLI documentation, so I don't have to manually add the trigger to the pipeline.

Is there a way to do that?

Apparently going through the doc az datafactory trigger create

az datafactory trigger create command, has properties , within which you have pipelineReference where referenceName should be assigned the Pipeline name that you want to associate this trigger with.

az datafactory trigger create --factory-name
                              --name
                              --properties
                              --resource-group
                              [--if-match]

--properties Expects values: json-string/json-file/@json-file. Personally I suggest you upload a json file with properties values to CLI and then reference it using @file-name.json

Example:

Creating a trigger exampleTrigger for pipeline TriggeredPipeline

Upload your json file with properties. (referenceName = pipeline name you want to add this trigger to)

{
    "type": "ScheduleTrigger",
    "pipelines": [
        {
            "parameters": {
                "OutputBlobNameList": [
                    "exampleoutput.csv"
                ]
            },
            "pipelineReference": {
                "type": "PipelineReference",
                "referenceName": "TriggeredPipeline"
            }
        }
    ],
    "typeProperties": {
        "recurrence": {
            "endTime": "2022-06-16T00:55:13.8441801Z",
            "frequency": "Minute",
            "interval": 4,
            "startTime": "2022-06-16T00:39:13.8441801Z",
            "timeZone": "UTC"
        }
    }
}

在此处输入图片说明

Reference uploaded properties file in command : (--properties " @<uploaded-properties-file-name> .json")

..

az datafactory trigger create --factory-name "testadf" --resource-group "your-resource-group-name" --properties "@properties.json" --name "exampleTrigger"

Verify from ADF Studio:

在此处输入图片说明

You can use az datafactory trigger update with Optional Parameters --add and --set specifying a properties file , path and value for updating an existing trigger.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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