Copying Data from On-Prem SQL to Azure with ADF
Azure Data Factory cannot reach a database behind your firewall, so a self-hosted integration runtime inside the network does the work. This guide covers how that flow operates, what the machine and firewall need, the linked service and Copy activity definitions, credentials, large tables and the usual failures.
GloryTecks Team
Training & Placement Faculty
Last updated: 2 October 2026
Azure Data Factory runs in Azure. Your SQL Server runs in a server room, behind a firewall that exists precisely to stop the internet reaching it. Copying from an on-premises SQL Server to Azure therefore needs one extra piece: software inside your network that can see the database and talk to Azure. That piece is the self-hosted integration runtime.
The definitions in this guide are written from Microsoft's documentation and have not been deployed.
How the hybrid copy works
The design avoids opening the network to inbound traffic. Microsoft describes the flow in four steps (Microsoft Learn: self-hosted integration runtime):
- You create a self-hosted integration runtime in the data factory, install it on a machine in your network, and create a linked service for the database that names it.
- The runtime encrypts the database credentials with Windows DPAPI and stores them locally.
- Data Factory schedules work through a control channel. The service queues a request, and the runtime starts the job after it polls the queue. The runtime calls out; nothing calls in.
- The runtime reads from the database and writes to cloud storage directly, over HTTPS.
Two things follow. The data does not pass through the Data Factory service on its way to storage; the runtime sends it. And the machine you install the runtime on is doing the real work, so its capacity matters. Integration runtimes in ADF covers the runtime types.
The machine
| Requirement | Detail |
|---|---|
| Operating system | 64-bit Windows: Windows 10 or 11, Windows Server 2016, 2019, 2022 or 2025 |
| Framework | .NET Framework 4.7.2 or later |
| Recommended minimum | 2 GHz processor with 4 cores, 8 GB of RAM, 80 GB of free disk |
| Not supported | Installation on a domain controller |
| Power | The machine must not hibernate; a hibernating host does not respond to requests |
| Rights | An administrator installs and configures it |
Three further points from the documentation save trouble later:
- Put it near the database, not on it. Microsoft recommends a different machine from the one hosting the data source, so the two do not compete for resources.
- Parquet needs Java. File creation happens on the runtime's machine, and writing Parquet, ORC or Avro requires a Java runtime, version 11, with the JAVA_HOME variable set. A copy to Parquet that fails immediately on a new runtime is usually this.
- Not beside the Power BI gateway. Both use port 443, and Microsoft advises against installing them on the same machine.
One instance can be installed per machine, and one runtime can serve many on-premises data sources.
The firewall
The runtime makes outbound connections on port 443. At the corporate firewall these destinations must be allowed:
| Destination | Port | Needed for |
|---|---|---|
| The data factory's own address, in the form of factory, region, then datafactory.azure.net | 443 | Connecting to the Data Factory service |
| Azure Relay addresses under servicebus.windows.net | 443 | Interactive authoring, such as test connection and data preview |
| download.microsoft.com | 443 | Automatic updates |
| The Key Vault address | 443 | Only if credentials are kept in Key Vault |
| Storage addresses under core.windows.net | 443 | Writing to Azure storage, including staged copy |
| Database addresses under database.windows.net | 1433 | Only when the sink is Azure SQL Database or Azure Synapse Analytics |
The last row has a documented way round it. With staged copy, the runtime sends data to staging storage over HTTPS on port 443, and the load into Azure SQL happens from there, so port 1433 need not be opened (Microsoft Learn: performance features).
Inside the network, the runtime must reach SQL Server: TCP/IP enabled on the instance, remote connections allowed, and the instance's port, 1433 by default, open in the Windows Firewall of the database server.
Step by step
Microsoft's tutorial follows this order (Microsoft Learn: SQL Server to Blob storage tutorial):
- Create the runtime. In the Manage hub, under Integration runtimes, choose New, then Self-Hosted. Give it a name.
- Install and register. Download the installer to the chosen machine, run it, and paste one of the authentication keys shown in the portal. The runtime then shows as running.
- Create the SQL Server linked service, selecting that runtime under Connect via integration runtime, and use Test connection.
- Create the linked service for the destination, for example a storage account.
- Create the datasets: the source table, and the destination folder and format.
- Create a pipeline with a Copy activity, run it with Debug, then publish and add a trigger.
Test connection in step 3 runs from the runtime's machine. If it fails, the problem is between that machine and the database, not in Azure.
The linked service
{
"name": "OnPremSalesDb",
"properties": {
"type": "SqlServer",
"typeProperties": {
"server": "sqlprod01.corp.example.com",
"database": "Sales",
"encrypt": "mandatory",
"trustServerCertificate": false,
"authenticationType": "SQL",
"userName": "adf_reader",
"password": {
"type": "AzureKeyVaultSecret",
"store": { "referenceName": "CorpKeyVault", "type": "LinkedServiceReference" },
"secretName": "sales-db-reader"
}
},
"connectVia": { "referenceName": "CorpSelfHostedIR", "type": "IntegrationRuntimeReference" }
}
}The property that makes this a hybrid connection is connectVia. Without it, the default Azure runtime is used, and it cannot see the server (Microsoft Learn: SQL Server connector). Linked services in Azure Data Factory covers the object in general.
Authentication. The connector supports SQL authentication and Windows authentication, where the user name takes the form of domain and user. Either way, use a dedicated account with read access to only the tables being copied.
Where the password lives. There are two documented choices: stored by Data Factory, in which case it is kept encrypted on the runtime's machine, or held in Azure Key Vault and fetched when an activity runs (Microsoft Learn: security considerations). Key Vault keeps the secret out of the factory's definition and lets it be rotated in one place. Azure Key Vault with Data Factory covers the set-up.
The Copy activity
{
"name": "CopyOrdersToLake",
"type": "Copy",
"inputs": [ { "referenceName": "OnPremOrdersTable", "type": "DatasetReference" } ],
"outputs": [ { "referenceName": "LakeOrdersParquet", "type": "DatasetReference" } ],
"typeProperties": {
"source": {
"type": "SqlSource",
"sqlReaderQuery": "SELECT OrderId, CustomerId, OrderDate, Amount FROM dbo.Orders WHERE OrderDate >= '2026-01-01'"
},
"sink": {
"type": "ParquetSink",
"storeSettings": { "type": "AzureBlobFSWriteSettings" }
}
}
}Nothing in the activity mentions the runtime. It is used because the source dataset points at a linked service that names it. Select the columns you need in the query; every unneeded column is data pushed up a link that is usually the slowest part of the route.
Large tables and slow links
- Partition the read. For a big table, a partition option makes the activity run several range queries in parallel. See data partitioning strategies.
- Scale the runtime. If its CPU is high or memory low, add nodes; if the machine is idle while jobs queue, raise the concurrent job limit. DIUs do not apply to a self-hosted runtime. ADF performance tuning explains how to find the bottleneck.
- Compress across the link. Staged copy can compress data on the premises before it is sent.
- Stop copying everything. After the first full load, copy only what changed; see incremental data loading.
Availability
A single runtime machine is a single point of failure. A runtime can have up to four nodes: install the software on another machine and register it with the same authentication key. Jobs continue when a node is down for patching, and throughput improves. Before adding a node, remote access to intranet must be enabled on the first one.
When it fails
| Symptom | Likely cause |
|---|---|
| Test connection fails | TCP/IP disabled on the instance, remote connections not allowed, or the port blocked on the database server |
| Runtime shows offline | The machine is asleep or stopped, or outbound 443 is blocked |
| Copy to Parquet fails at once | No Java runtime on the runtime's machine |
| Copy to Azure SQL fails to connect | Port 1433 outbound is blocked; use staged copy |
| Jobs wait a long time before starting | The runtime is at its concurrent job limit |
| Error that the session limit for the database has been reached | Microsoft's tip is to add Pooling=false to the connection string |
Other routes
A self-hosted runtime is the standard answer and not the only one. Microsoft's connector documentation notes that the managed virtual network integration runtime can reach an on-premises network through a private endpoint, without installing a self-hosted runtime. It needs private connectivity between Azure and the site.
A private circuit does not remove the need for a runtime inside the network: the guidance is to treat a data source behind ExpressRoute as on-premises all the same.
Can Azure Data Factory connect to an on-premises SQL Server directly?
Do I have to open inbound ports for the self-hosted integration runtime?
Does my data pass through the Data Factory service?
Why does copying to Parquet fail on a self-hosted runtime?
Azure Data Factory and hybrid data integration are covered in the Data Engineering course.
Sources
- Copy data from SQL Server to Blob storage using Azure portal (Microsoft Learn) — Microsoft Learn
- Create a self-hosted integration runtime (Microsoft Learn) — Microsoft Learn
- Copy and transform data to and from SQL Server (Microsoft Learn) — Microsoft Learn
- Security considerations for data movement in Azure Data Factory (Microsoft Learn) — Microsoft Learn
- Copy activity performance optimization features (Microsoft Learn) — Microsoft Learn
GloryTecks Team
Training & Placement Faculty
The GloryTecks faculty team mentors learners across Data Science, AI and Data Engineering, with a focus on real-time projects and placement readiness in Hyderabad.
Want to master Azure Data Factory?
Join GloryTecks’ expert-led SQL Server training in Hyderabad with real-time projects and 100% placement support.
Related articles
Azure Data Factory Roadmap 2026: A Complete Guide
A staged roadmap for learning Azure Data Factory in 2026: the six building blocks and how they relate, five stages from a first copy pipeline to deployed and monitored pipelines, a checkpoint for each stage, how Microsoft Fabric changes the picture, the state of the certifications, and the skills ADF does not replace.
Linked Services in Azure Data Factory Explained
A linked service is how Azure Data Factory connects to a data store or a compute service. This guide covers the two kinds, the anatomy of the JSON, authentication from keys to managed identities, keeping secrets in Key Vault, parameterising one linked service for many databases, and handling development and production.
Copy Activity in Azure Data Factory: A Practical Guide
The Copy activity is the workhorse of Azure Data Factory. This guide explains what it does in three steps, the formats and stores it handles, column mapping, the sink write behaviours, insert, pre-copy script and upsert, compared on a real table across three runs, fault tolerance, staging, and reading the output.