How to Fix SQL Server Error 33028 (Msg 33028)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see sql server error 33028 when the database cannot open a cryptographic provider session. You can fix it by checking your external key provider and service account rights. This failure returns message 33028 at severity level 16 in the database engine. The engine stops the current command because it cannot reach the external key provider. It also prints a specific provider error code to help you find the fault. Root causes of sql server error 33028 in the engine The official message stat

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You see sql server error 33028 when the database cannot open a cryptographic provider session. You can fix it by checking your external key provider and service account rights.

This failure returns message 33028 at severity level 16 in the database engine. The engine stops the current command because it cannot reach the external key provider. It also prints a specific provider error code to help you find the fault.

Root causes of sql server error 33028 in the engine

The official message states that the engine cannot open a session for the provider. When the database runs encryption tasks, it talks to an external key module. This module holds the keys that protect your sensitive database files and columns.

First, the external key provider library or hardware module might be offline or unreachable. A network drop between the database host and the key server breaks the handshake. The provider then returns its own error code inside the message text.

Second, the Windows account running the database service might lack local file permissions. If the service account cannot read the provider driver file, the session fails. Expiring client certificates on the host can also block the provider handshake.

Third, the login running the query might lack a valid credential mapping. The database uses mapped credentials to log in to the external key store. If the password or secret changes on the key server, the session request fails.

How to check and fix the failure in production

Start by reading the exact provider error code shown at the end of the message. That number comes from the third-party key vendor, not the database engine itself. Look up that number in your key provider manual to see the exact cause.

Next, check the network path from the database host to the key appliance. Verify that firewall rules allow traffic on the port used by your key server. Check that the provider file exists on the host disk and has read rights.

Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If the provider works, check the identity mapping inside the database engine. A database user is the identity of a login when it connects to a database. For people who need access to many databases on an instance, a login in master is common. For access to one or a few databases, a contained database user is an option. An admin must first enable contained databases on the server and the database.

Do not fix permission errors by adding users to the database owner role. Members of that owner role can perform all maintenance tasks and can drop the database. Instead, grant only the exact role needed for the job. All roles, including the public role, have basic connect rights by default.

Preventing session failures with least privilege

Many teams hit provider errors because they share one high-level login across many apps. When one engineer updates a shared secret, every other app loses its key session. You can stop this by giving each person and app a separate identity.

Keep routine data queries separate from key management tasks. Give normal users the data reader role so they can read all user tables. Use the data writer role when a user must add, delete, or change table data. You cannot change the permissions assigned to these fixed database roles.

When you limit who can alter cryptographic credentials, you avoid surprise outages in production. Track every change to server logins and key mappings in your central logs. Test any key rotation in a staging setup before you update production credentials.

Govern SQL Server queries and responses in flight

Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.

With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.

Frequently asked questions

What does severity 16 mean for message 33028?

Severity 16 means the error is a general problem that the user can fix. It stops the current query, but it does not crash the whole database server.

Where do I find the meaning of the provider error code?

The provider error code comes directly from your external hardware security module or key store. Check the support manual from your key module vendor to translate that specific number.

Should I grant the database owner role to fix error 33028?

No, the owner role gives full control and lets the user drop the database. Fix the credential mapping or service account rights instead of granting broad database roles.

The query runs. The emails stay hidden.