Hello Lockyer, Aaron (SGRE COG B MS SYS BSPM)!
Thanks for posting your query on Microsoft QnA! and explaining your use case. Thanks Alex Burlachenko for your detailed answer. In addition to Alex Burlachenko answer, I would like to add my findings.
There isn’t a built-in ADF feature that lets you automatically cancel a copy activity in real-time based on whether data is actually being read or written. The pipeline activity timeout setting is global for the entire activity and won’t distinguish between an active but slow transfer and an idle one with no data movement. Also, the diagnostic metrics and logs for “rows read,” “bytes written,” or “time to first byte” are only available after the activity finishes; there isn’t support for subscribing to these indicators while the copy job is still in progress.
A few common workarounds are available, but each has limitations:
- Lower the overall activity timeout: This will forcibly stop long-running jobs, but it doesn’t check if data is being transferred and might cancel jobs that are just slow, not idle.
- Use external automation with Logic Apps, Azure Functions, or PowerShell to poll ADF activity runs using the Data Factory REST API. However, this approach can only see metrics once the activity is done—not “live” data movement status. There is currently no API field or metric indicating “last data received” or “rows read so far” in real-time.
There’s no direct way in Azure Data Factory (ADF) to automatically cancel a copy activity in progress based on detecting an idle state (no data read/copied) via native features. The standard activity timeout you can set applies to the entire activity regardless of whether any data movement is occurring—so lowering it risks stopping healthy, slow-running jobs as well as those that are truly stuck. The ADF UI and monitoring tools only expose details such as “rows read” and “time to first byte” after the copy activity completes, not in real time, which means nothing built-in can act on live, mid-job progress to trigger a targeted cancellation.
You can configure timeouts and monitor pipeline runs after the fact using ADF monitoring and Activity Run outputs (copy activity timeouts documentation), but live progress metrics are not currently surfaced in the API or monitoring interface. Automation with services like Logic Apps or scheduled checks via the Data Factory REST API also only allow you to act on job-level status (Succeeded, Failed, Cancelled, etc.) and cannot see in-flight, per-minute data movement.
To summarize, while you can set copy activity-level timeouts in ADF, there is currently no supported method to automatically detect and cancel only copy activities that are idle (not moving data) in real time.
Reference:
- https://learn.microsoft.com/en-us/azure/data-factory/copy-activity-overview#timeouts
- https://learn.microsoft.com/en-us/azure/data-factory/copy-activity-monitoring?tabs=data-factory
If this control is important to your data flows, consider submitting feedback through Microsoft’s documentation or product feedback channels, as this is a recognized area with opportunity for improvement on the platform.
Please "Accept as Answer" or do a Upvote if the answer provided is useful, so that you can help others in the community looking for remediation for similar issues.
Thanks
Pratyush