Parameter value in Data Factory Triggered pipeline
-
06-01-2021 - |
Pregunta
I have a pipeline configured in azure data factory which basically does create a backup file (JSON) from a cosmosDB dataset and it's saved in a blob storage, my problem comes when I want to schedule the copy task in a trigger, I see that I have to specify the value for windowStart (parameter already defined to name the JSON file with the date of the execution. ) as shown below:
Destination path:
And as you can see when I want to trigger it does ask me to specify the value for windowStart.
I tried below functions to specify that with no success so far:
"@{pipeline().parameters.windowStart}"
"@{formatDateTime(pipeline().startTime,'o')"
"@{formatDateTime(utcnow(),'yyyy-MM-dd')}"
"@{formatDateTime(trigger().startTime,'yyyy-MM-dd')}"
And the error I always get is as shown below:
Have anyone any idea or way to fix that, or have someone faced the same issue before ?
Solución
Finally I was able to fix this by creating the trigger using a JSON code as shown below:
{
"name": "yourTriggerName",
"properties": {
"runtimeState": "Started",
"pipelines": [
{
"pipelineReference": {
"referenceName": "YourPipelineName",
"type": "PipelineReference"
},
"parameters": {
"windowStart": "@trigger().scheduledTime"
}
}
],
"type": "ScheduleTrigger",
"typeProperties": {
"recurrence": {
"frequency": "Day",
"interval": 1,
"startTime": "2018-07-11T17:00:00Z",
"timeZone": "UTC",
"schedule": {
"minutes": [
20
],
"hours": [
19
]
}
}
}
}
}
And making emphasis of course, in line below:
"parameters": {
"windowStart": "@trigger().scheduledTime"
After that, the copy activity started to work as expected.