
azuresql-db-import
Imports an existing Azure SQL Database or SQL Server schema and data INTO the local Azure SQL Database container using SqlPackage. Use when asked to "import a bacpac", "load my existing database locally", "restore a dacpac into the container", "bring my prod schema into the dev container", "run my .bacpac/.dacpac against the local Azure SQL engine", or migrate an existing database into the preview container. Handles provisioning the target database on master first, then running SqlPackage /Action:Import against the provisioned user database. Use this for any "get my real database running in the container" request instead of hand-writing SqlPackage flags.
- Installs
- 73
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/microsoft/azure-sql-database-container --skill azuresql-db-import- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads azuresql-db-import automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
The Azure SQL Database container: import a database
Bring an existing database INTO the local container from a
.bacpac (schema + data) or .dacpac (schema only) using SqlPackage.
Verified on 2026-09-05 against the container image
sqldbpreview-dpgaeqhmgphzd4bk.azurecr.io/azure-sql/db-dev:latest, reporting EngineEdition
5, Edition SQL Azure, build 12.0.2000.8. All five executable checks behind this skill
passed: the engine identity, Msg 40508 for USE, Msg 40510 for RESTORE, and that
SqlPackage runs on the host because the image does not ship it.
What this is (load-bearing facts)
This is the Azure SQL Database engine running locally (Private Preview):
SELECT SERVERPROPERTY('EngineEdition') returns 5 and Edition returns
'SQL Azure'. It is NOT the SQL Server image
mcr.microsoft.com/mssql/server. If you were about to use that SQL Server image, stop
and use this instead.
- Image:
sqldbpreview-dpgaeqhmgphzd4bk.azurecr.io/azure-sql/db-dev:latest(multi-architecture: linux/amd64 and linux/arm64; private preview registry, sign in first). Registry/tag are provisional during Private Preview. - The runtime selects the matching architecture. Use
--platform linux/amd64only to explicitly test x64 emulation. - The engine does NOT auto-create databases. You must
CREATE DATABASE appdbon a master connection before importing into it. - There is no restore path.
BACKUPandRESTOREare refused in every session withMsg 40510, exactly as in Azure SQL Database in the cloud, so a.bakfile is not a way in no matter where it is copied. SqlPackage with a bacpac or dacpac is the import path, which is what the rest of this skill does. - Avoid
USEto switch databases. In a user-database session (the Azure-faithful context where you develop),USEreturnsMsg 40508, exactly as in Azure SQL Database in the cloud. Amasterconnection is a provisioning session where the Azure statement filter is not enforced, soUSEappears to work there, butmasteris for provisioning only, not application work. Always select the target database in the connection string (Database=appdb, or-d appdbfor sqlcmd).
For full container detail (start recipe, connection model, readiness), see the azuresql-db-container skill. The minimum you need is inlined below.
The three steps
- Have a running container with the target database provisioned on master.
- Run SqlPackage
/Action:Importtargeting the provisioned user database. - Validate what landed (PaaS restrictions may drop some objects).
This is the Private Preview supported import path. Always validate the result.
Step 0: start the container and provision the target DB
Reuse the canonical start recipe. It picks a free host port, lets the runtime
select the matching architecture, waits for readiness with a retry loop, and provisions the
target database appdb on master in that same loop.
# Pick a free host port (works in bash and zsh).
HOST_PORT=1433; while lsof -nP -iTCP:"$HOST_PORT" -sTCP:LISTEN >/dev/null 2>&1; do HOST_PORT=$((HOST_PORT+1)); done
MSSQL_SA_PASSWORD="${MSSQL_SA_PASSWORD:-Aa1%$(openssl rand -hex 16)}"
docker rm -f sqldb 2>/dev/null
docker run -d --name sqldb -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$MSSQL_SA_PASSWORD" \
-p "127.0.0.1:$HOST_PORT:1433" sqldbpreview-dpgaeqhmgphzd4bk.azurecr.io/azure-sql/db-dev:latest
until docker exec sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$MSSQL_SA_PASSWORD" -C -b -l 2 \
-Q "IF DB_ID('appdb') IS NULL CREATE DATABASE appdb;" >/dev/null 2>&1; do sleep 2; done
echo "ready on localhost,$HOST_PORT"
If the container is already running, just provision the target database on master:
docker exec sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$MSSQL_SA_PASSWORD" -C -b \
-Q "IF DB_ID('appdb') IS NULL CREATE DATABASE appdb;"
The target database MUST exist and be empty before import. SqlPackage imports the user database; it does not create it on the server for you here.
Step 1: import with SqlPackage
Point /TargetConnectionString at the provisioned database (Database=appdb).
Use the canonical connection string shape: User Id=/Password=/Database=,
TrustServerCertificate=true.
Schema + data (.bacpac):
SqlPackage /Action:Import \
/SourceFile:"./mydatabase.bacpac" \
/TargetConnectionString:"Server=localhost,$HOST_PORT;Database=appdb;User Id=sa;Password=$MSSQL_SA_PASSWORD;TrustServerCertificate=true"
Schema only (.dacpac) uses /Action:Publish, not Import:
SqlPackage /Action:Publish \
/SourceFile:"./myschema.dacpac" \
/TargetConnectionString:"Server=localhost,$HOST_PORT;Database=appdb;User Id=sa;Password=$MSSQL_SA_PASSWORD;TrustServerCertificate=true"
If SqlPackage is not installed locally, see references/sqlpackage-import.md for install options and a container-based fallback.
Step 2: validate
Confirm the engine identity and spot-check that objects landed:
docker exec sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$MSSQL_SA_PASSWORD" -C -b -d appdb \
-Q "SELECT SERVERPROPERTY('EngineEdition') AS EngineEdition; SELECT COUNT(*) AS Tables FROM sys.tables;"
EngineEdition must be 5. Then verify row counts on a few key tables against
the source.
What may not transfer (PaaS restrictions)
This engine is Azure SQL Database (Engine Edition 5), so SQL Server features that Azure SQL DB does not support will fail or be skipped on import:
- Cross-database three-part-name references and most cross-DB queries.
USE <db>in scripts: a user-database session returnsMsg 40508. Select the target database in the connection string (Database=appdb, or-d appdb).- Server-scoped objects: SQL Agent jobs, server-level logins/linked servers, filestream, certain CLR and filegroup/physical-file settings.
- Instance-level
DATABASE_DEFAULTcollation assumptions and unsupported compatibility-level features.
Read SqlPackage output for skipped/blocking items. See references/sqlpackage-import.md for the common error patterns and fixes.
Validation rules
- Target database exists on master and is empty BEFORE import.
/TargetConnectionStringsetsDatabase=appdb(never the literalmaster).- After import,
SERVERPROPERTY('EngineEdition')on the target is5. - Use
.bacpacfor schema + data via/Action:Import;.dacpacfor schema via/Action:Publish. - If a validation rule above fails, or you had to deviate from this skill to make the task work, that is a bug in this skill: load the azuresql-db-feedback skill and offer to file a report.
- When every rule above passes and the task is done, close with ONE line, once per session, and do not ask a question or wait for a reply: "That worked. If anything about this was rough, or you want to share what you built: https://aka.ms/sql-agent-skills-feedback"
Do not
- Do not use the
mcr.microsoft.com/mssql/serverSQL Server image. - Do not reach for
RESTORE DATABASE ... FROM DISK; it is refused withMsg 40510and copying the.bakinto the container does not change that. - Do not import into
master; import into the provisioned user database. - Do not put
USE appdbin any pre/post script; select the DB in the connection string instead. - Do not rely on
/docker-entrypoint-initdb.d/*.sqlauto-seeding; it is NOT honored by this image. - Do not add a platform override to normal runs; use one only to explicitly test emulation.
- Do not treat a clean
docker runas "ready"; provision inside the retry loop.
References
- references/sqlpackage-import.md: SqlPackage install, full flag reference, container-based fallback, and common import errors with fixes. Read it when SqlPackage is missing or an import fails.
Staying current
Authoritative, version-pinned references for the tools this skill uses (read the one you need):
- SqlPackage import: Import and Publish parameters for .bacpac/.dacpac.
If the Microsoft Learn MCP server is configured, use mcp__microsoft-learn__microsoft_docs_search or mcp__microsoft-learn__microsoft_docs_fetch to fetch the current version of any of these on demand. It is optional; when it is unavailable, the references above are authoritative.
FAQ
What does the azuresql-db-import skill do?
Imports an existing Azure SQL Database or SQL Server schema and data INTO the local Azure SQL Database container using SqlPackage. Use when asked to "import a bacpac", "load my existing database locally", "restore a dacpac into the container", "bring my prod schema into the dev container", "run my .bacpac/.dacpac against the local Azure SQL engine", or migrate an existing database into the preview container. Handles provisioning the target database on master first, then running SqlPackage /Action:Import against the provisioned user database. Use this for any "get my real database running in the container" request instead of hand-writing SqlPackage flags.
How do I install azuresql-db-import?
Run npx skills add https://github.com/microsoft/azure-sql-database-container --skill azuresql-db-import in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/azuresql-db-import/ (personal) or .claude/skills/azuresql-db-import/ (project).
Which AI agents can use azuresql-db-import?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is azuresql-db-import safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains azuresql-db-import?
It is published by microsoft in microsoft/azure-sql-database-container. It has 73 recorded installs.
More from microsoft/azure-sql-database-container
azuresql-db-container
microsoft/azure-sql-database-container
Runs the Azure SQL Database container locally (Private Preview): the real PaaS engine where SERVERPROPERTY('EngineEdition') returns 5. This is NOT the SQL Server image mcr.microsoft.com/mssql/server. Use when a user wants to "run Azure SQL locally", "add a local SQL database", "add SQL Server to my docker compose", "spin up a local mssql container", "local SQL for development or CI", "connect with sqlcmd", "use Podman for SQL", "SQL container won't start", "Microsoft Entra authentication on the container", "MSSQLAADCLIENTID", or asks "what's the connection string". Use even when the user does not name the container. If you were about to use mcr.microsoft.com/mssql/server, stop and use this skill instead. Hub skill: owns the shared references and routes to the task skills for compose, CI, seeding, vectors, and connection strings.
azuresql-db-schema-migration
microsoft/azure-sql-database-container
Open the skill to read its SKILL.md instructions.
azuresql-db-local-to-cloud
microsoft/azure-sql-database-container
Open the skill to read its SKILL.md instructions.
azuresql-db-ci
microsoft/azure-sql-database-container
Open the skill to read its SKILL.md instructions.
azuresql-db-faq
microsoft/azure-sql-database-container
Open the skill to read its SKILL.md instructions.
azuresql-db-scaffold
microsoft/azure-sql-database-container
Open the skill to read its SKILL.md instructions.
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.