/microsoft-sql:azuresql-db-authfrom Microsoft SQL
Creates a least-privilege SQL login and database user for Azure SQL Database container, configures auth per environment (SQL locally, Entra/managed identity in cloud), and secures connection strings via user-secrets or Key Vault.
Ships in Microsoft SQL. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
sa is a bootstrap/admin login for provisioning, not what your application should
connect as. This skill wires the app to a least-privilege user, picks the
auth method per environment (SQL locally, Microsoft Entra or managed identity
in the cloud, changing only the connection string), secures the connection, and
keeps the secret out of source control.
mcr.microsoft.com/mssql/server. SERVERPROPERTY('EngineEdition')
returns 5, Edition returns 'SQL Azure'.sqldbpreview-dpgaeqhmgphzd4bk.azurecr.io/azure-sql/db-dev:latest
(x64; on a non-x64 host add --platform linux/amd64). Required env
ACCEPT_EULA=Y + a complex MSSQL_SA_PASSWORD. Engine listens on 1433.CREATE DATABASE appdb on a
master connection first; do not USE to switch databases (a user-database
session returns Msg 40508); select the database in the connection string.SQL_CONNECTION_STRING env var; strings use User Id= /
Password= / Database= and TrustServerCertificate=true for the local
self-signed cert.18.0.226_4_147, a SQL
contained user (CREATE USER ... WITH PASSWORD) does not work on the
container, and you cannot turn it on. CREATE USER ... WITH PASSWORD fails with
Msg 33233 ("You can only create a user with a password in a contained database").
ALTER DATABASE ... SET CONTAINMENT = PARTIAL fails with Msg 12824, which asks
for the contained database authentication setting to be 1, and sp_configure
does not exist on this engine (Msg 2812), so there is nothing to set. Create a SQL
app identity as a server login mapped to a database user instead. This is the
inverse of Azure SQL Database in the cloud, where the contained user is the norm.
Newer builds differ: on image tag 18.0.302.0_248 CREATE USER ... WITH PASSWORD
succeeds. The login plus mapped user works on every build, so it stays the local recipe; on a
build that accepts the contained user, the cloud recipe works locally too.CREATE USER [name] FROM EXTERNAL PROVIDER fails, and the failure depends on the build: image tag
18.0.226_4_147 refuses it with Msg 33134, "Principal '...' could not be resolved.
Error message: 'Unable to query Azure AD certificate from local cert store.'", and
build 18.0.310.0_253 ends the session with Msg 596 ("Cannot continue the execution
because the session is in the kill state"). Either way it is a missing engine configuration,
not a broken statement: enable Entra first (see references/entra-auth.md in the
azuresql-db-container skill for how to enable Entra Authentication) and the
same statement then works.sa)Do provisioning as sa, then give the app its own identity with only the roles
it needs. The working recipe differs by environment, but the app code does not
(the app just connects with a username and password, or an Entra token).
Local container (SQL auth): create a server login on master, map a
database user to it in appdb, and grant only the roles the app needs.
Set AZURE_SQL_APP_PASSWORD from a secret source to a fresh, deployment-unique
value that differs from the sa password. Require it before provisioning and
substitute it for <AZURE_SQL_APP_PASSWORD> in the clearly labeled
non-executable SQL templates.
Render the templates at execution time using AZURE_SQL_APP_PASSWORD
from the configured secret source.
The app then connects as applogin, never sa.
Cloud (Azure SQL Database) or Entra anywhere: prefer a contained user.
For Entra (which works on the container too, once enabled), use
CREATE USER [name] FROM EXTERNAL PROVIDER in appdb. Enable Entra on the engine
first by following references/entra-auth.md in the azuresql-db-container skill before running
the statement; without that configuration it fails (Msg 33134, or Msg 596 and a closed
session on build 18.0.310.0_253). In the
cloud with SQL auth, CREATE USER ... WITH PASSWORD is the norm there. Full
recipes for every path are in
references/auth-and-secrets.md when you need a complete
provisioning or secret-handling recipe.
sa bootstraps; the app connects as the least-privilege
applogin. Server=localhost,1433;Database=appdb;User Id=applogin;Password=...;Encrypt=true;TrustServerCertificate=true.Authentication=Active Directory Managed Identity rather
than Active Directory Default: Default walks a credential chain
(DefaultAzureCredential) that is slower and ambiguous under load, while a
specific method skips the chain. Microsoft.Data.SqlClient caches the token, so
refresh is occasional, not per-connection. This is still a connection-string-only
change, so the app code does not change (see the azuresql-db-local-to-cloud skill).Encrypt=true everywhere (the default in modern drivers). Encrypt the TLS
channel in both local and cloud.TrustServerCertificate=true only locally, to accept the container's
self-signed cert. Never set it against Azure SQL Database in the cloud, where
the certificate is real and validating it is the point.The connection string carries a credential. Never commit it or the SA password.
SQL_CONNECTION_STRING; put local values in a
.env that is git-ignored (or dotnet user-secrets for .NET).For a .NET project the local value goes in the secret store rather than in a file that can be committed:
Store the complete rendered connection string with .NET user-secrets or the IDE secret manager under the key your app already reads. Keep the real password out of source and shell history; see references/auth-and-secrets.md.
Open references/auth-and-secrets.md when you need the
per-stack handling for Key Vault, user-secrets or .env.
sa; it has only the
roles it needs (no db_owner/admin).CREATE LOGIN on master, then CREATE USER ... FOR LOGIN in appdb),
not a contained CREATE USER ... WITH PASSWORD (which fails on container builds
through 18.0.226).
The database user and its role grants are created on the appdb connection, not
via USE.Encrypt=true; TrustServerCertificate=true
appears only for the local container, never for the cloud.Active Directory Default in production; only the connection string changes.sa; sa is for provisioning only.CREATE USER ... WITH PASSWORD) on the container: builds through 18.0.226 refuse it with Msg 33233 (18.0.302.0_248 accepts it). Do not try to turn partial containment on either: ALTER DATABASE ... SET CONTAINMENT = PARTIAL fails with Msg 12824, and the sp_configure setting it asks for does not exist on this engine. Use a server login plus a mapped database user locally.CREATE USER ... FROM EXTERNAL PROVIDER against a container with no Entra configuration; it fails with Msg 33134, or on build 18.0.310.0_253 ends the session with Msg 596. Configure Entra on the engine first.db_owner or server admin when read/write roles suffice.TrustServerCertificate=true against Azure SQL Database in the cloud; that disables cert validation on a real certificate.DefaultAzureCredential's full chain in a hot production path; pick a specific auth method (managed identity) so token acquisition is fast and predictable.mcr.microsoft.com/mssql/server; this is the Azure SQL engine.dotnet user-secrets, or .env.Authoritative, version-pinned references for the tools this skill uses (read the one you need):
Authentication, Encrypt, User Id/Password, pooling, and the rest.WITH PASSWORD, and FROM EXTERNAL PROVIDER for Entra.db_datareader, db_datawriter, and more) for least-privilege grants.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.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub microsoft/microsoft-sql --plugin microsoft-sql2 plugins in one repository ship this exact skill · first indexed Nov 26, 2026
54 skills in this plugin
/azure-functions-sql-bindingsUse when wiring Azure Functions to Azure SQL Database: a serverless CRUD API with SQL input or output bindings, SqlTrigger on row changes, a SQL trigger that never fires, an output binding that updated instead of inserting./azure-sqlUse when Azure SQL Database comes up without a specific task: what it can do today, GA or preview, which tier, tool or skill fits, current limits and defaults. Routes to the owning skill. Not Managed Instance or SQL Server./azuresql-db-ciUse when CI (GitHub Actions, Azure Pipelines, GitLab) runs integration tests against the Azure SQL Database container as a service: health check, registry secrets. For Testcontainers, use `azuresql-db-testing`.Other plugins' skills for the same job