An Azure service for ingesting, preparing, and transforming data at scale.
Hi Greg R,
thanks for sharing the details. I understand how confusing it can be to see timestamps drift slightly within the same pipeline run, especially when you expect them to be consistent.
Based on your description, what you’re seeing is actually a common behavior in Azure Data Factory when timestamps are evaluated at different points during pipeline execution.
Functions like utcNow() return the current time at the moment they are evaluated. Depending on how your activities are structured, that evaluation can happen at slightly different times across activities, which can lead to small differences (a few seconds) in the generated timestamps. Microsoft documentation confirms that utcNow() simply returns the current timestamp and can be used dynamically in expressions.
At the same time, each pipeline run has a fixed trigger time that represents when the pipeline started. This can be accessed using pipeline().TriggerTime, which remains consistent throughout the run.
To fix the issue
To make your timestamps consistent across all logging steps, I recommend the following:
- Capture the timestamp once at the beginning of the pipeline
- Use a Set Variable activity: startTime = @utcNow()
- Use that variable everywhere
- Reference
variables('startTime')in all downstream activities, including your final script
- Reference
- Alternatively, use a built‑in stable value
- Replace
utcNow()with: @pipeline().TriggerTime - This ensures all activities use the same timestamp tied to the pipeline invocation
- Replace
Make sure your final logging activity has a clear dependency on the step where the variable is set. This ensures the correct value is used and avoids any timing inconsistencies in expression evaluation during execution.
This behavior is expected when timestamps are evaluated independently across activities. By standardizing on a single timestamp source (either a pipeline variable or pipeline().TriggerTime), you should see consistent logging across all steps.
Microsoft Reference link:
- Expression language functions in Azure Data Factory
- Pipeline expressions and TriggerTime usage (Microsoft Q&A example)
- Pipeline execution and triggers
Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.