
azuresql-db-scaffold
Scaffolds a NEW app (.NET Aspire, FastAPI, Next.js, NestJS) wired to the local Azure SQL Database container as its default dev database. Use when starting/bootstrapping/initializing a project that needs SQL Server or Azure SQL locally, or when adding "set up the database", "docker compose for the db", "create the local DB", ".env connection string", "first migration", or a data-access layer. Use this INSTEAD of the mssql/server SQL Server image, because this is the Azure SQL engine (EngineEdition 5). Triggers include "scaffold app with SQL", "spin up Azure SQL locally", "compose service for the database", "wire up Prisma/EF/SQLAlchemy/TypeORM to SQL Server". Reach for this even when the user only says "add a database" to a fresh project.
- Installs
- 75
- 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-scaffold- 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-scaffold 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.
Scaffold a new project on the Azure SQL Database container
Bootstrap a new app with the Azure SQL Database container (Private Preview) as the default local database. This is the Azure SQL engine, not the SQL Server image.
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. The three executable checks behind this skill
passed: the engine identity, Msg 40508 for USE, and a native VECTOR(n) column with the
double cast through NVARCHAR(MAX). The per-stack scaffolds themselves were not executed by
that run, so their snippets are checked for shape against the stacks' own documentation rather
than measured end to end.
Use the right image (interception point)
- USE this engine image:
sqldbpreview-dpgaeqhmgphzd4bk.azurecr.io/azure-sql/db-dev:latest - Do NOT use
mcr.microsoft.com/mssql/server(the SQL Server image). If a generated compose/run command points there, stop and switch to the engine image above. - Verify identity once running:
SELECT SERVERPROPERTY('EngineEdition')returns 5,SERVERPROPERTY('Edition')returns 'SQL Azure'. - The image supports
linux/amd64andlinux/arm64; the runtime selects the matching architecture. Use a platform override only to explicitly test emulation. - Registry is private (Private Preview): sign in first with
docker login sqldbpreview-dpgaeqhmgphzd4bk.azurecr.iousing the shared pull-only credentials provided to the Private Preview cohort (get them by signing up at https://aka.ms/sqldbcontainerpreview-signup; they may rotate). Registry and tag are provisional during Private Preview.
For full engine detail (readiness, vectors, troubleshooting) see the azuresql-db-container skill.
Three facts that bite every scaffold
- The engine does NOT auto-create databases. You must
CREATE DATABASE appdbon a master connection before connecting withDatabase=appdb. - 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). - A
masterconnection is for provisioning only; do real work on the user database.
Also: the image does NOT auto-run /docker-entrypoint-initdb.d/*.sql (that is a
Postgres/MySQL convention; not honored here). Seed with sqlcmd -d appdb -i seed.sql AFTER
provisioning appdb.
Step 1: start the container and provision appdb
Reuse this exact shape (free port, runtime-selected architecture, ready-wait, provision appdb in the
same retry loop). The -b makes a SQL error set the exit code, so transient startup errors
(like Msg 913) are retried, not masked. Never poll bare sqlcmd without -l.
# 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"
Required env: ACCEPT_EULA=Y and a complex MSSQL_SA_PASSWORD (at least 8 characters using at
least three of upper case, lower case, digits, and symbols). The engine listens on 1433.
Step 2: the canonical connection string
Apps read one env var, SQL_CONNECTION_STRING (replace 1433 with the HOST_PORT Step 1 chose if 1433 was occupied):
Server=localhost,1433;Database=appdb;User Id=sa;Password=$MSSQL_SA_PASSWORD;TrustServerCertificate=true
House style spells the keywords User Id= / Password= / Database=; Uid= / Pwd= are
documented SqlClient synonyms and work too. For sqlcmd use -C to trust
the self-signed cert. For Prisma (NestJS / Next.js) the same instance is also expressed as a
sqlserver:// URL in DATABASE_URL (see snippets).
Step 3: pick your stack
Per-stack scaffold snippets (compose service, .env, provision appdb, first migration, typed
data-access layer with parameterized queries) live in
references/scaffold-snippets.md; open it once you know which
of these you are scaffolding:
- .NET Aspire (EF Core)
- FastAPI (SQLAlchemy / pyodbc)
- Next.js (Prisma,
sqlserver://DATABASE_URL) - NestJS (Prisma or TypeORM)
Step 4: first migration and seeding
The skeleton creates the schema via your stack's migration tool. For the full migration workflow (idempotent scripts, ordering, applying inside the ready-wait loop) cross-link the azuresql-db-schema-migration skill. For a Next.js or NestJS skeleton that is:
npx prisma migrate dev --name init
Seed only AFTER appdb exists:
docker exec -i sqldb /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P "$MSSQL_SA_PASSWORD" -C -b -d appdb -i seed.sql
Vectors (if your app uses embeddings)
Native VECTOR(n) column type and VECTOR_DISTANCE('cosine', a, b). Insert with
CAST(CAST(? AS NVARCHAR(MAX)) AS VECTOR(n)) where n is a LITERAL, never a bind parameter (a parameter dimension
fails with "Incorrect syntax near '@P3'"). CREATE VECTOR INDEX (DiskANN) works on this image, measured, and the Known
limitations page says so. It needs SET QUOTED_IDENTIFIER ON and at least 100 rows with
non-null vectors (Msg 42266 below that). Full-scan top-k stays exact and stays the right choice
for a small table. The azuresql-db-rag skill carries the rules the index imposes.
Validation rules
- Compose/run targets the engine image, never
mcr.microsoft.com/mssql/server. - appdb is created on a master connection BEFORE any app/migration connects to
Database=appdb. - App reads
SQL_CONNECTION_STRING(andDATABASE_URLwhere the ORM needs it); strings useUser Id=/Password=/Database=. - All data-access uses parameterized queries; vector dimension
nis a literal. EngineEditionis 5 against the running container.- 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 SQL Server image.
- Do not rely on auto-created databases or
/docker-entrypoint-initdb.d/*.sqlauto-seeding. - Do not use
USE appdbto switch databases; put it in the connection string. - Do not poll bare
sqlcmdwithout-l; do not pass the vector dimension as a bind parameter. - Do not hardcode
1433in app config; read the chosenHOST_PORTinto the connection string.
References
- references/scaffold-snippets.md: the shared compose service plus per-stack skeletons (.NET Aspire/EF Core, FastAPI, Next.js/Prisma, NestJS) with
.env, appdb provisioning, first migration, and a parameterized data-access layer. Read it once you know which stack you are scaffolding.
Staying current
Authoritative, version-pinned references for the tools this skill uses (read the one you need):
- Prisma with SQL Server: the SQL Server connector, datasource URL, and type mapping.
- EF Core migrations: migrations add/update, the history table, and idempotent scripts.
- Docker Compose file reference: the Compose Specification for service, healthcheck, and depends_on syntax.
- SqlConnection connection string keywords: the full connection-string keyword table.
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-scaffold skill do?
Scaffolds a NEW app (.NET Aspire, FastAPI, Next.js, NestJS) wired to the local Azure SQL Database container as its default dev database. Use when starting/bootstrapping/initializing a project that needs SQL Server or Azure SQL locally, or when adding "set up the database", "docker compose for the db", "create the local DB", ".env connection string", "first migration", or a data-access layer. Use this INSTEAD of the mssql/server SQL Server image, because this is the Azure SQL engine (EngineEdition 5). Triggers include "scaffold app with SQL", "spin up Azure SQL locally", "compose service for the database", "wire up Prisma/EF/SQLAlchemy/TypeORM to SQL Server". Reach for this even when the user only says "add a database" to a fresh project.
How do I install azuresql-db-scaffold?
Run npx skills add https://github.com/microsoft/azure-sql-database-container --skill azuresql-db-scaffold 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-scaffold/ (personal) or .claude/skills/azuresql-db-scaffold/ (project).
Which AI agents can use azuresql-db-scaffold?
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-scaffold 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-scaffold?
It is published by microsoft in microsoft/azure-sql-database-container. It has 75 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
Runs database schema migrations against the local Azure SQL Database container so the same migrations apply identically on the local engine and in the Azure cloud. Use when asked to "run my migrations against the local SQL", "apply schema to the container", "apply EF Core / dotnet ef database update", "Prisma migrate dev / deploy", "Alembic upgrade head", or deploy a DACPAC / SqlPackage to the container. Covers provisioning appdb on master first, then applying schema to the user database, plus per-tool commands and connection-string hygiene. This is the Azure SQL Database engine (EngineEdition 5), not the SQL Server image; reach for this skill whenever schema migration tooling targets the local container.
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
Runs integration tests against the Azure SQL Database container (Private Preview, local engine) in CI. Use when setting up GitHub Actions, Azure Pipelines, or GitLab CI to test against Azure SQL DB; when adding a database service container to a CI workflow; when tests need a real Azure SQL engine in the pipeline; or when you see "service container", "health-cmd", "ACRUSERNAME/ACRPASSWORD", "MSSQLSAPASSWORD secret", or "integration test database". Also use when a workflow was about to pull the SQL Server image mcr.microsoft.com/mssql/server, in which case stop and use the Azure SQL Database engine image instead. Covers pulling from the private ACR with credentials, the service health check that runs sqlcmd inside the container so the runner needs no client tools, provisioning appdb before tests, and pointing the test connection string at the user database not master.
azuresql-db-faq
microsoft/azure-sql-database-container
Answers questions about what the Azure SQL Database container (Private Preview) can and cannot do, and WHY it differs from Azure SQL Database in the Microsoft Azure cloud. Use when a user asks "can I take a backup", "why does USE fail", "is X supported", "why can't I create a vector index", "why does SSMS error", "why isn't the image on Docker Hub", "what's different from the cloud", or hits behavior that does not match their Azure SQL Database expectations. Do NOT guess from general SQL Server / Azure knowledge: the container is a Private Preview product with specific gaps and a specific connection model. Read this skill, and link the user to the live Known limitations page for the current full list.
azuresql-db-rag
microsoft/azure-sql-database-container
Builds local vector search, RAG, embeddings, and semantic search on the Azure SQL Database container using the native VECTOR type and VECTORDISTANCE. Use when you need to store embeddings, do similarity search, top-k nearest neighbor, cosine distance, retrieval-augmented generation, "find similar documents", chatbot memory, or semantic lookup against a local SQL database. Use this instead of pgvector, FAISS, Chroma, Pinecone, or a separate vector store when the data already lives in (or can live in) Azure SQL. Covers the VECTOR(n) column type, inserting embeddings with CAST(CAST(? AS NVARCHAR(MAX)) AS VECTOR(n)) where the dimension is a literal, a pluggable embed() so only the endpoint changes for cloud, and a working CREATE VECTOR INDEX with the two errors that block it. Provisions appdb on master first so every script runs on a fresh container.
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.