How to Fix SQL Server Error 41974 (Msg 41974)
You see sql server error 41974 when a database link lacks an imported endpoint certificate. You fix it by importing the certificate from Azure SQL Managed Instance to the server. This issue carries a severity level of 16 in the database engine. That number means a user or admin can fix the setup mistake. The engine blocks the link until both sides trust each other. Below, we cover why this error happens and how to resolve it safely. What causes sql server error 41974 in your database The off
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 41974 when a database link lacks an imported endpoint certificate. You fix it by importing the certificate from Azure SQL Managed Instance to the server.
This issue carries a severity level of 16 in the database engine. That number means a user or admin can fix the setup mistake. The engine blocks the link until both sides trust each other. Below, we cover why this error happens and how to resolve it safely.
What causes sql server error 41974 in your database
The official error message states that the database link cannot be established. It fails because the endpoint certificate from Azure SQL Managed Instance is not imported. When two database instances form a link, they need mutual trust. They use public key certificates to verify identity over the network.
If the local instance lacks the cloud endpoint key, the handshake fails right away. The database engine stops the link creation and returns message code 41974. This often happens during a fresh hybrid setup or after a certificate rotation. A team member might create the cloud side of the link first. If they skip the key import step on the local host, the connection drops.
Network blocks or expired keys can cause similar link problems. Still, message 41974 points straight to a missing certificate in the master database. The engine checks the system catalog for the matching public key. When that check comes back empty, the setup task halts to protect your data.
How to diagnose and fix the failure in production
First, check the system catalog on your local database server. Look at the list of imported certificates in the master database. Confirm whether the public key from your Azure SQL Managed Instance is present. If it is missing, fetch the current endpoint key from your cloud instance.
Next, import that certificate into the master database on your local server. Bind the imported certificate to the mirroring or link endpoint as required. Once the key is in place, retry the link creation task. The two servers will complete their handshake and start syncing data.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
During this fix, do not grant excessive privileges to the engineer running the checks. A database user is the identity of a login when it connects to a database. For people who need access to many databases, a login in master is common. Avoid handing out the db_owner role just to check a broken link. Members of db_owner can perform all maintenance tasks and can even drop the database.
Instead, limit what each user can do while they inspect the system. Members of db_datareader can read all data from all user tables and views. If an engineer only needs to check table states, use that read role. The permissions assigned to fixed database roles cannot be changed. You can also use db_denydatawriter so the user cannot add, modify, or delete data. Keep write permissions tight while you fix the certificate trust on the server.
Preventing certificate drift across hybrid database links
Certificate errors often return when keys expire or when teams rebuild cloud instances. Keep a clear log of every endpoint certificate used across your hybrid links. When you rotate a key in the cloud, update the local server right away. Test the link status in a staging setup before you touch production servers.
You should also audit who has rights to change server keys and roles. Limit master database changes to a small group of senior admins. When fewer people change link settings, you avoid missing key imports and unexpected downtime. Good access rules keep your hybrid links stable and your sensitive data safe. Masking rules can also rewrite emails, phone numbers, card numbers, and national IDs in results.
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 sql server error 41974?
Severity 16 means the error comes from a setup issue that admins can fix. It does not mean a hardware crash or a corrupted database file.
Where does the endpoint certificate need to be imported?
You must import the endpoint certificate from Azure SQL Managed Instance into the local server. It goes into the master database so the engine can verify the link.
Should I grant db_owner to engineers investigating link errors?
No, because db_owner lets a user change any setting or drop the database. Grant read roles like db_datareader for table checks and restrict master key changes.
Related guides
In this post