/microsoft-sql-admin:always-encrypted-columnsfrom Microsoft SQL administration
Evaluates which plaintext columns in a SQL Server table are eligible for Always Encrypted. Runs T-SQL queries to determine encryption candidates and explains disqualification reasons.
Ships in Microsoft SQL administration. 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.
None: SKILL.md is the whole skill.
Use this skill only when the user asks which currently plaintext columns are eligible candidates for Always Encrypted or wants a table evaluated for prospective encryption eligibility.
Do not use this workflow to inventory existing encryption. Requests containing "already encrypted," "currently encrypted," "which CEK," "which column encryption key," or "which column master key" need an existing-encryption catalog query, not the eligibility query below.
microsoft-sql-admin plugin (mssql_list_database_connections,
mssql_connect_database, then mssql_execute_query); any other SQL tool the agent host provides for
running T-SQL and reading result sets;
sqlcmd from a terminal. If the SQL
Tools MCP server is not connected or lists no connections, follow the sql-tools-mcp-setup skill,
which asks before installing or configuring anything. If no SQL tool can be made available, give the
user the T-SQL to run and ask for the results.VIEW SERVER PERFORMANCE STATE (VIEW SERVER STATE before SQL Server 2022) or, on Azure
SQL Database, VIEW DATABASE PERFORMANCE STATE or ##MS_ServerStateReader##, plus any other read
permission these queries need. A tool is only as read-only as the login it connects with.The user must provide $SchemaName and $TableName parameters.
DECLARE @SchemaName SYSNAME = '$SchemaName',
@TableName SYSNAME = '$TableName';
DECLARE @TableId INT;
SELECT @TableId = t.object_id
FROM sys.tables AS t
JOIN sys.schemas AS s ON t.schema_id = s.schema_id
WHERE s.name = @SchemaName AND t.name = @TableName
OPTION (MAXDOP 1);
IF @TableId IS NULL
BEGIN
RAISERROR('Table %s.%s not found!', 16, 1, @SchemaName, @TableName);
RETURN;
END;
;WITH ColumnList AS (
SELECT
c.object_id, c.column_id, c.name AS ColumnName,
CASE
WHEN t.name IN ('decimal','numeric')
THEN t.name + '(' + CAST(c.precision AS VARCHAR(10)) + ',' + CAST(c.scale AS VARCHAR(10)) + ')'
WHEN t.name IN ('char','varchar','nchar','nvarchar')
THEN t.name +
CASE WHEN c.max_length = -1 THEN '(max)'
WHEN t.name IN ('nchar','nvarchar') THEN '(' + CAST(c.max_length/2 AS VARCHAR(10)) + ')'
ELSE '(' + CAST(c.max_length AS VARCHAR(10)) + ')' END
WHEN t.name IN ('binary','varbinary')
THEN t.name + CASE WHEN c.max_length = -1 THEN '(max)' ELSE '(' + CAST(c.max_length AS VARCHAR(10)) + ')' END
ELSE t.name
END AS ColumnType,
c.is_nullable
FROM sys.columns AS c
JOIN sys.types AS t ON c.user_type_id = t.user_type_id
WHERE c.object_id = @TableId
),
Violations AS (
SELECT c.object_id, c.column_id, CAST(NULL AS NVARCHAR(200)) AS Reason, CAST(NULL AS INT) AS ReasonCode
FROM ColumnList AS c WHERE 1=0
UNION ALL SELECT c.object_id, c.column_id, 'Unsupported data type (' + ut.name + ')', 1
FROM ColumnList c JOIN sys.columns col ON col.object_id = c.object_id AND col.column_id = c.column_id
JOIN sys.types ut ON col.user_type_id = ut.user_type_id
WHERE LOWER(ut.name) IN ('xml','text','ntext','image','timestamp','rowversion','sql_variant','hierarchyid','geography','geometry') OR ut.is_user_defined = 1
UNION ALL SELECT c.object_id, c.column_id, 'Identity column', 2
FROM ColumnList c JOIN sys.columns col ON col.object_id = c.object_id AND col.column_id = c.column_id WHERE col.is_identity = 1
UNION ALL SELECT c.object_id, c.column_id, 'FILESTREAM column', 3
FROM ColumnList c JOIN sys.columns col ON col.object_id = c.object_id AND col.column_id = c.column_id WHERE col.is_filestream = 1
UNION ALL SELECT c.object_id, c.column_id, 'ROWGUIDCOL column', 4
FROM ColumnList c JOIN sys.columns col ON col.object_id = c.object_id AND col.column_id = c.column_id WHERE col.is_rowguidcol = 1
UNION ALL SELECT c.object_id, c.column_id, 'Computed column', 5
FROM ColumnList c JOIN sys.columns col ON col.object_id = c.object_id AND col.column_id = c.column_id WHERE col.is_computed = 1
UNION ALL SELECT c.object_id, c.column_id, 'Sparse column set', 7
FROM ColumnList c JOIN sys.columns col ON col.object_id = c.object_id AND col.column_id = c.column_id WHERE col.is_sparse = 1 AND col.is_column_set = 1
UNION ALL SELECT c.object_id, c.column_id, 'Primary key column', 8
FROM ColumnList c JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id
JOIN sys.indexes ix ON ix.object_id = ic.object_id AND ix.index_id = ic.index_id WHERE ix.is_primary_key = 1
UNION ALL SELECT c.object_id, c.column_id, 'Unique index/constraint', 9
FROM ColumnList c JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id
JOIN sys.indexes ix ON ix.object_id = ic.object_id AND ix.index_id = ic.index_id WHERE ix.is_unique = 1 AND ix.is_primary_key = 0
UNION ALL SELECT c.object_id, c.column_id, 'Indexed column', 10
FROM ColumnList c JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id
JOIN sys.indexes ix ON ix.object_id = ic.object_id AND ix.index_id = ic.index_id WHERE ix.is_primary_key = 0 AND ix.is_unique = 0
UNION ALL SELECT c.object_id, c.column_id, 'Full-text index', 11
FROM ColumnList c JOIN sys.fulltext_index_columns fti ON fti.object_id = c.object_id AND fti.column_id = c.column_id
UNION ALL SELECT c.object_id, c.column_id, 'Default constraint', 12
FROM ColumnList c JOIN sys.default_constraints dc ON dc.parent_object_id = c.object_id AND dc.parent_column_id = c.column_id
UNION ALL SELECT c.object_id, c.column_id, 'Check constraint', 13
FROM ColumnList c JOIN sys.check_constraints ck ON ck.parent_object_id = c.object_id
WHERE ck.definition LIKE '%[' + c.ColumnName + ']%' OR ' ' + ck.definition + ' ' LIKE '% ' + c.ColumnName + ' %'
UNION ALL SELECT c.object_id, c.column_id, 'Foreign key constraint', 14
FROM ColumnList c JOIN sys.foreign_key_columns fk
ON (fk.parent_object_id = c.object_id AND fk.parent_column_id = c.column_id)
OR (fk.referenced_object_id = c.object_id AND fk.referenced_column_id = c.column_id)
UNION ALL SELECT c.object_id, c.column_id, 'Statistics on column', 15
FROM ColumnList c JOIN sys.stats_columns sc ON sc.object_id = c.object_id AND sc.column_id = c.column_id
UNION ALL SELECT c.object_id, c.column_id, 'Partitioning column', 16
FROM ColumnList c JOIN sys.index_columns ic ON ic.object_id = c.object_id AND ic.column_id = c.column_id WHERE ic.partition_ordinal = 1
UNION ALL SELECT c.object_id, c.column_id, 'Change Data Capture (CDC)', 17
FROM ColumnList c JOIN sys.tables t ON t.object_id = c.object_id WHERE t.is_tracked_by_cdc = 1
UNION ALL SELECT c.object_id, c.column_id, 'Dynamic Data Masking', 18
FROM ColumnList c JOIN sys.masked_columns m ON m.object_id = c.object_id AND m.column_id = c.column_id
UNION ALL SELECT c.object_id, c.column_id, 'Stretch-enabled table', 19
FROM ColumnList c JOIN sys.tables t ON t.object_id = c.object_id WHERE t.is_remote_data_archive_enabled = 1
UNION ALL SELECT c.object_id, c.column_id, 'External table', 20
FROM ColumnList c JOIN sys.tables t ON t.object_id = c.object_id WHERE t.is_external = 1
)
SELECT
cl.ColumnName,
cl.ColumnType,
CanBeEncrypted = CASE WHEN v.ReasonList IS NULL THEN 'Yes' ELSE 'No' END,
Reason = ISNULL(v.ReasonList, 'meets all required conditions')
FROM ColumnList AS cl
OUTER APPLY (
SELECT STRING_AGG(Reason, '; ') WITHIN GROUP (ORDER BY ReasonCode) AS ReasonList
FROM Violations WHERE Violations.object_id = cl.object_id AND Violations.column_id = cl.column_id
) AS v
ORDER BY cl.column_id
OPTION (MAXDOP 1);
Report all columns — even those that do not meet requirements — as a Markdown table:
| Column Name | Column Type | Can Be Encrypted | Reason |
|---|
A column cannot be encrypted if it:
Note: CHAR, VARCHAR, NCHAR, NVARCHAR, VARCHAR(MAX), NVARCHAR(MAX) columns will have their collation changed to binary-code point (_BIN2) if encrypted.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub microsoft/microsoft-sql --plugin microsoft-sql-admin47 skills in this plugin
/active-connectionsUse when the user asks who is connected, which sessions are idle or hold the oldest open transaction, or how connections split by login or app. If a client can't connect, use `connectivity-troubleshoot`./authentication-diagnosticsUse when a login fails (18456, 'Login failed for user'), a user can't open a database, a permission is denied, or an Entra or managed identity login fails. For network errors, use `connectivity-troubleshoot`./backup-history-azuresqlUse when the user asks for backup history, the latest backups or backup retention on Azure SQL Database or Fabric SQL Database. For SQL Server or Managed Instance, use `backup-strategy-sqlserver`.Other plugins' skills for the same job