azsqlbcp 2026.9.2.7
dotnet tool install --global azsqlbcp --version 2026.9.2.7
dotnet new tool-manifest
dotnet tool install --local azsqlbcp --version 2026.9.2.7
#tool dotnet:?package=azsqlbcp&version=2026.9.2.7
nuke :add-package azsqlbcp --version 2026.9.2.7
azsqlbcp
Azure SQL Bulk Copy .NET global tool. Copy a table between two Azure SQL databases (optionally partitioned and parallel) using SqlBulkCopy and Microsoft Entra authentication.
Install
dotnet tool install -g azsqlbcp
Requires the .NET 10 runtime (or SDK).
Usage
azsqlbcp \
--source-server <host> \
--source-database <db> \
--source-table <schema.table> \
--target-server <host> \
--target-database <db> \
--target-table <schema.table> \
--partition-column <bigintIdentityColumn>
Options
| Option | Description |
|---|---|
--source-server |
Source Azure SQL logical server |
--source-database |
Source database |
--source-table |
Source table (schema.table or table → dbo) |
--source-port |
Source TCP port (default: 1433) |
--source-trust-server-certificate |
Trust source server certificate (default: false) |
--target-server |
Target Azure SQL logical server |
--target-database |
Target database |
--target-table |
Target table |
--target-port |
Target TCP port (default: 1433) |
--target-trust-server-certificate |
Trust target server certificate (default: false) |
--partition-column |
Integer column used to split work |
--no-partition-column |
Single-stream copy (SELECT *); do not pass --partition-column |
--source-read-only |
Set ApplicationIntent=ReadOnly on source (Business Critical read scale-out) |
--parallelism |
Concurrent copy streams (default: 6) |
--partitions |
Number of partition work units (default: same as --parallelism) |
--partition-strategy |
id-range (default) or row-balanced |
--batch-size |
SqlBulkCopy batch size (default: 2000000) |
--checkpoint-file |
Enable resumable mode; JSON checkpoint path |
--resume |
Continue from checkpoint (skip truncate) |
--reconcile |
With --resume: verify in-progress partitions via target COUNT (slow) |
--force |
Truncate target and restart checkpoint from scratch |
--max-retries |
Transient retries per partition (default: 5) |
--retry-base-delay-ms |
Retry backoff base in ms (default: 2000) |
Examples
Partitioned parallel copy:
Requires a consistent source for the duration of the export (no inserts/updates/deletes in the copied id range while the job runs), otherwise partitions can miss or double-count rows.
azsqlbcp `
--source-server prod.database.windows.net `
--source-database SourceDb `
--source-table dbo.MyTable `
--target-server staging.database.windows.net `
--target-database TargetDb `
--target-table bak.MyTable_Copy `
--partition-column Id `
--source-read-only
Resumable copy with checkpoint (row-balanced partitions, 64 work units, 8 concurrent):
azsqlbcp `
--source-server prod.database.windows.net `
--source-database SourceDb `
--source-table dbo.PeriodVolumes `
--target-server staging.database.windows.net `
--target-database TargetDb `
--target-table bak.PeriodVolumes_Copy `
--partition-column PeriodID `
--partition-strategy row-balanced `
--partitions 64 `
--parallelism 8 `
--checkpoint-file .\period-volumes.copy.json
Resume after failure (--batch-size / --parallelism may differ from the original run):
azsqlbcp `
... (same connection/table/partition args) `
--checkpoint-file .\period-volumes.copy.json `
--batch-size 250000 `
--resume
Restart from scratch (truncate + new plan):
azsqlbcp `
... `
--checkpoint-file .\period-volumes.copy.json `
--force
Single stream (no partition column):
azsqlbcp `
--source-server prod.database.windows.net `
--source-database SourceDb `
--source-table dbo.MyTable `
--target-server staging.database.windows.net `
--target-database TargetDb `
--target-table bak.MyTable_Copy `
--no-partition-column
What it does
- Authenticates with Microsoft Entra ID via
DefaultAzureCredential(token cached) - Truncates the target table (skipped on
--resume) - Reads row count (and min/max of the partition column when partitioning)
- Runs one or more parallel
SqlBulkCopystreams withKeepIdentityand streaming - Shows Spectre progress (%, remaining, elapsed, rows/s)
Resumable mode
When --checkpoint-file is set:
- Partition boundaries and expected row counts are stored in the checkpoint (immutable plan)
- Each partition is copied idempotently: delete target slice → bulk copy → verify counts
- Transient network/SQL errors retry per partition with exponential backoff
- Completed partitions are skipped on
--resume; pending/in-progress/failed partitions are deleted and re-copied - By default
--resumeskips expensive COUNT reconciliation; pass--reconcileonly if you need to recover partitions that finished verify but were not marked completed - When change tracking is enabled on the source database and table, the checkpoint records
CHANGE_TRACKING_CURRENT_VERSION()as a sync baseline for downstream incremental catch-up
Authentication
Uses DefaultAzureCredential (Azure CLI, Visual Studio, managed identity, etc.). Locally, az login is typically enough. The identity needs read on the source and truncate/insert on the target.
Permissions
- Source:
SELECT(and preferably a Business Critical replica when using--source-read-only) - Target:
ALTER/TRUNCATE,INSERT, andDELETE(for resumable partition slices)
Icon
Package icon: Duplicate Spreadsheet Icon #7721123 by Miftakhul Rizky (Noun Project), royalty-free. See icon/LICENSE.md.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.9.2.7 | 52 | 9/2/2026 |
| 2026.8.31.4 | 87 | 8/31/2026 |