I am trying to copy data from SQL Table in a on-prem sql server and upload it to a Document DB using custom activity in Azure data factory pipeline. Can anyone tell me how can I
Actually, Custom activity cannot access on-prem data today.
Similar question here: On-Prem SQL connection throwing SqlException in Datafactory custom activity
The solution is copy on-prem data to cloud. Then run custom activity against cloud storage. wBob shared good sample above.
If you have to complete it in one activity, you can setup vNet and ExpressRoute to connect your Azure public cloud with your onprem environment.