AZDBR 2026.6.26.5
dotnet tool install --global AZDBR --version 2026.6.26.5
dotnet new tool-manifest
dotnet tool install --local AZDBR --version 2026.6.26.5
#tool dotnet:?package=AZDBR&version=2026.6.26.5
nuke :add-package AZDBR --version 2026.6.26.5
azdbr
Azure SQL Database Refresh .NET global tool. Safely refresh a staging or development Azure SQL database from production within the same Microsoft Entra tenant.
Install
dotnet tool install -g azdbr
Usage
azdbr refresh <source-server> <source-database> <target-server> <target-database>
Example:
azdbr refresh prod-server prod-db staging staging-db
azdbr refresh prod-server prod-db staging staging-db --dry-run
azdbr refresh prod-server prod-db staging staging-db -y --service-objective S2
azdbr refresh prod-server prod-db staging staging-db --keep-old-database
Options
| Option | Description |
|---|---|
--tenant-id |
Optional Microsoft Entra tenant id for authentication |
--service-objective |
Optional service objective for the copied database |
--backup-storage-redundancy |
Optional redundancy: LOCAL, ZONE, GEO, GEOZONE |
--keep-old-database |
Keep the renamed old database after success |
--dry-run |
Run preflight and print planned steps only |
-y, --yes |
Skip interactive confirmation |
--command-timeout-minutes |
SQL command timeout for non-copy operations (default: 30) |
--copy-timeout-minutes |
Maximum wait time for copy completion (default: 240) |
What it does
- Validates that the target database exists and no leftover
*-olddatabase remains - Kills active user sessions on the target database
- Renames the target database to
<target-database>-old - Verifies the target database name is free
- Creates a new database with
CREATE DATABASE ... AS COPY OF - Fixes orphaned login-based users
- Syncs staging-only roles, users, and role memberships from the old database
- Drops the old database by default
Permissions
The identity running azdbr must:
- Authenticate with Microsoft Entra ID via
DefaultAzureCredential - Be a member of
dbmanagerinmasteron both source and target servers - Have
db_owneron the source database
See Copy a database in Azure SQL Database for platform details.
Limitations
- Same Microsoft Entra tenant only in v1
- Cross-tenant copy requires SQL authentication and is not supported by this tool
- Database copy over a private endpoint to the destination server is not supported by Azure SQL T-SQL copy
- Both server firewalls must allow the machine running
azdbr
Build and test
dotnet cake.cs
This runs restore, build, test, pack, and tool integration tests (azdbr --help).
Integration tests
The Cake pipeline installs the packed tool locally and runs:
azdbr --help(always)azdbr refresh ... -yagainst real Azure SQL when integration secrets are configured
Set these environment variables (or GitHub Actions secrets) to enable the Azure SQL integration test:
| Variable | Description |
|---|---|
AZDBR_INTEGRATION_SOURCE_SERVER |
Source logical server |
AZDBR_INTEGRATION_SOURCE_DATABASE |
Source database |
AZDBR_INTEGRATION_TARGET_SERVER |
Target logical server |
AZDBR_INTEGRATION_TARGET_DATABASE |
Target database (must exist) |
AZDBR_INTEGRATION_TENANT_ID |
Optional Entra tenant for the refresh |
AZURE_TENANT_ID |
Service principal tenant (CI) |
AZURE_CLIENT_ID |
Service principal client id (CI) |
AZURE_CLIENT_SECRET |
Service principal secret (CI) |
Locally, the Azure refresh test runs when the four AZDBR_INTEGRATION_* server/database variables are set and you are authenticated via az login / DefaultAzureCredential. In CI, the same four variables plus Azure service principal credentials are required.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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.6.26.5 | 92 | 6/26/2026 |