
azuresql-db-auth
Connects an app to the Azure SQL Database container securely, with a least-privilege database user instead of the sa login, the right auth method per environment, and safe handling of the connection secret. Use when a user asks "don't use sa in my app", "create a least-privilege database user", "app login for SQL", "which authentication should my app use", "secure the connection string", "Encrypt / TrustServerCertificate", "store the connection string in Key Vault", "dotnet user-secrets", "managed identity for Azure SQL", or "grant only the roles my app needs". SQL auth locally, Microsoft Entra or managed identity in the cloud, changing only the connection string. Reach for this before wiring an app to connect as sa, or before committing a connection string to source.
- Installs
- 54
- 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-auth- 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-auth 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.
Connect securely to the Azure SQL Database container (least-privilege user, auth, secrets)
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.
Re-measured on 2026-09-19 against the container image tag 18.0.226_4_147, reporting
EngineEdition 5, Edition SQL Azure, build 12.0.2000.8. All seven executable checks
behind this skill pass, and three of the numbers this skill used to print were wrong:
a contained user is refused with Msg 33233 and not Msg 15007, SET CONTAINMENT = PARTIAL is refused with Msg 12824 and not Msg 12844, and
CREATE USER ... FROM EXTERNAL PROVIDER on a container started without Entra
configuration is refused with Msg 33134 and not Msg 37525. Each statement is still
refused, so every instruction here is unchanged; only the numbers to expect are. The fixed
database roles this skill grants were confirmed on the same run. The cloud side of this
guidance, Azure Key Vault and managed identity, was not measured and comes from Microsoft
Learn.
Load-bearing facts (inlined; full engine detail in azuresql-db-container)
- This is the Azure SQL Database engine (Private Preview), not the SQL Server
image
mcr.microsoft.com/mssql/server.SERVERPROPERTY('EngineEdition')returns5,Editionreturns'SQL Azure'. - Image:
sqldbpreview-dpgaeqhmgphzd4bk.azurecr.io/azure-sql/db-dev:latest(multi-architecture:linux/amd64andlinux/arm64; the runtime selects the matching image). Required envACCEPT_EULA=Y+ a complexMSSQL_SA_PASSWORD. Engine listens on 1433. - The engine does NOT auto-create databases.
CREATE DATABASE appdbon a master connection first; do notUSEto switch databases (a user-database session returnsMsg 40508); select the database in the connection string. - Apps read one
SQL_CONNECTION_STRINGenv var; strings useUser Id=/Password=/Database=andTrustServerCertificate=truefor the local self-signed cert. - Container-specific and verified: a SQL contained user
(
CREATE USER ... WITH PASSWORD) does not work on the container today, and you cannot turn it on.CREATE USER ... WITH PASSWORDfails withMsg 33233("You can only create a user with a password in a contained database").ALTER DATABASE ... SET CONTAINMENT = PARTIALfails withMsg 12824, which asks for thecontained database authenticationsetting to be 1, andsp_configuredoes 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. Measured 2026-09-19 on image tag18.0.226_4_147. - Entra has to be configured on the engine before you can use it. On a
container started with no Microsoft Entra ID configuration,
CREATE USER [name] FROM EXTERNAL PROVIDERis refused withMsg 33134, "Principal '...' could not be resolved. Error message: 'Unable to query Azure AD certificate from local cert store.'" That is a missing engine configuration, not a broken statement: enable Entra first (seereferences/entra-auth.mdin the azuresql-db-container skill) and the same statement then works. Measured 2026-09-19 on image tag18.0.226_4_147.
Step 1: create a least-privilege user (not 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.
-- On a master connection:
CREATE LOGIN applogin WITH PASSWORD = 'An0ther_Str0ng_Passw0rd';
-- On an appdb connection (Database=appdb):
CREATE USER appuser FOR LOGIN applogin;
ALTER ROLE db_datareader ADD MEMBER appuser; -- read
ALTER ROLE db_datawriter ADD MEMBER appuser; -- write
-- Grant EXECUTE only if the app calls procedures; do NOT add db_owner.
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 via the azuresql-db-container skill, references/entra-auth.md; without
that configuration the statement is refused with Msg 33134. 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.
Step 2: pick the auth method per environment (only the connection string changes)
- Local: SQL auth.
sabootstraps; the app connects as the least-privilegeapplogin.Server=localhost,1433;Database=appdb;User Id=applogin;Password=...;Encrypt=true;TrustServerCertificate=true. - Cloud (Azure SQL Database): prefer a token-based identity over a password.
In production, use
Authentication=Active Directory Managed Identityrather thanActive Directory Default:Defaultwalks a credential chain (DefaultAzureCredential) that is slower and ambiguous under load, while a specific method skips the chain.Microsoft.Data.SqlClientcaches 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).
Step 3: secure the connection
Encrypt=trueeverywhere (the default in modern drivers). Encrypt the TLS channel in both local and cloud.TrustServerCertificate=trueonly 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.
Step 4: keep the secret out of source
The connection string carries a credential. Never commit it or the SA password.
- Read it from one env var,
SQL_CONNECTION_STRING; put local values in a.envthat is git-ignored (ordotnet user-secretsfor .NET). - In the cloud, store it in Azure Key Vault and reference it, or use managed identity so there is no password to store at all.
For a .NET project the local value goes in the secret store rather than in a file that can be committed:
dotnet user-secrets init
dotnet user-secrets set "SQL_CONNECTION_STRING" "Server=localhost,1433;Database=appdb;User Id=appuser;Password=$MSSQL_SA_PASSWORD;TrustServerCertificate=true"
Open references/auth-and-secrets.md when you need the
per-stack handling for Key Vault, user-secrets or .env.
Validation rules
- The app connects as a least-privilege identity, not
sa; it has only the roles it needs (nodb_owner/admin). - On the container, the SQL app identity is a server login + mapped database
user (
CREATE LOGINon master, thenCREATE USER ... FOR LOGINinappdb), not a containedCREATE USER ... WITH PASSWORD(which fails on the container). The database user and its role grants are created on theappdbconnection, not viaUSE. - Every connection string sets
Encrypt=true;TrustServerCertificate=trueappears only for the local container, never for the cloud. - The connection string / SA password is read from a secret store or a git-ignored env var, never committed.
- Cloud auth prefers managed identity / a specific Entra method over
Active Directory Defaultin production; only the connection string changes. - 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 connect the application as
sa;sais for provisioning only. - Do not try to create a SQL contained user with
CREATE USER ... WITH PASSWORDon the container; it fails withMsg 33233. Do not try to turn partial containment on either:ALTER DATABASE ... SET CONTAINMENT = PARTIALfails withMsg 12824, and thesp_configuresetting it asks for does not exist on this engine. Use a server login plus a mapped database user locally. - Do not run
CREATE USER ... FROM EXTERNAL PROVIDERagainst a container with no Entra configuration; it is refused withMsg 33134. Configure Entra on the engine first. - Do not grant the app
db_owneror server admin when read/write roles suffice. - Do not commit the connection string or the SA password; use a secret store or a git-ignored env var.
- Do not set
TrustServerCertificate=trueagainst Azure SQL Database in the cloud; that disables cert validation on a real certificate. - Do not lean on
DefaultAzureCredential's full chain in a hot production path; pick a specific auth method (managed identity) so token acquisition is fast and predictable. - Do not use the SQL Server image
mcr.microsoft.com/mssql/server; this is the Azure SQL engine.
References
- references/auth-and-secrets.md: creating least-privilege users (SQL contained user + roles, a login + user split, and Entra
CREATE USER FROM EXTERNAL PROVIDER), the connection strings per environment (SQL, Entra, managed identity), and per-stack secret handling (Azure Key Vault,dotnet user-secrets,.env).
Staying current
Authoritative, version-pinned references for the tools this skill uses (read the one you need):
- SqlConnection connection string keywords:
Authentication,Encrypt,User Id/Password, pooling, and the rest. - CREATE USER (Transact-SQL): contained users,
WITH PASSWORD, andFROM EXTERNAL PROVIDERfor Entra. - Database-level roles: the fixed roles (
db_datareader,db_datawriter, and more) for least-privilege grants. - Microsoft Entra authentication for Azure SQL: Entra and managed-identity auth in the cloud.
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-auth skill do?
Connects an app to the Azure SQL Database container securely, with a least-privilege database user instead of the sa login, the right auth method per environment, and safe handling of the connection secret. Use when a user asks "don't use sa in my app", "create a least-privilege database user", "app login for SQL", "which authentication should my app use", "secure the connection string", "Encrypt / TrustServerCertificate", "store the connection string in Key Vault", "dotnet user-secrets", "managed identity for Azure SQL", or "grant only the roles my app needs". SQL auth locally, Microsoft Entra or managed identity in the cloud, changing only the connection string. Reach for this before wiring an app to connect as sa, or before committing a connection string to source.
How do I install azuresql-db-auth?
Run npx skills add https://github.com/microsoft/azure-sql-database-container --skill azuresql-db-auth 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-auth/ (personal) or .claude/skills/azuresql-db-auth/ (project).
Which AI agents can use azuresql-db-auth?
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-auth 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-auth?
It is published by microsoft in microsoft/azure-sql-database-container. It has 54 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 backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.