r/SQLServer • u/drn101 • Feb 25 '26
Question SQL 2025 – Msg 7416 “Access to the remote server is denied because no login-mapping exists” (but mapping exists)
SQL 2025 – Msg 7416 “Access to the remote server is denied because no login-mapping exists” (but mapping exists)
After upgrading from SQL 2019 to SQL 2025, I’m seeing this error when a linked server is queried:
Msg 7416 Access to the remote server is denied because no login-mapping exists.
The linked server has a default mapping configured:
EXEC sp_addlinkedsrvlogin
@rmtsrvname = N'HIST',
@useself = 'FALSE',
@locallogin = NULL,
@rmtuser = N'HISTReadOnly',
@rmtpassword = '*******';
sp_helplinkedsrvlogin confirms: <ALL LOGINS (NULL)> → HISTReadOnly
No explicit per-login overrides
In one pair of servers I can replicate the error in SSMS and in another case I cannot and it works fine in SSMS The only consistant fix/workaround I've seen is granting what should be a read-only SQLLogin full sysadmin permissions. Which is not ideal.
Specifically I’ve seen 7416 appear in the following scenarios.
PIOLEDB provider Particularly with OSI PI / historian environments where provider activation or execution context differences surface only for non-sysadmin logins. Eg, PowerBI Gateway using a SQLLogin to query a PIOLEDB linked server from another SQL server.
Application server → SQL via ODBC/DSN → view → OPENQUERY → linked server Example:
- SAP BO server connects via DSN
- Queries a SQL view
- View internally calls OPENQUERY against a linked server
- Interactive execution works
- Application path throws 7416
- Execution context differences Even when login mapping exists, the effective context during application execution may differ from interactive SSMS testing.
What’s Interesting
- Works interactively.
- Mapping exists and is global (@locallogin = NULL).
- Only fails in certain execution paths.
- Making the login sysadmin immediately resolves it.
Has anyone noticed changes in SQL Server 2025 around:
Linked server security evaluation for SQL Logins? Provider activation behavior (especially PIOLEDB)? Differences between interactive and application execution contexts?
Not looking for generic “add mapping” advice — the mapping is present and correct. I’m more interested in whether anyone has seen 7416 crop up post-upgrade under specific provider or application-call scenarios.
My only next step from here after hours troubleshooting with GPTs is to spin up some clean lab environments to try and replicate the issue more. It's frustrating that this didn't come up during the upgrades as my validations didn't involve specific querying of linked servers using sql logins I mainly focused on the basic right click and 'Test connection'.
EDIT: For this pioledb provider I found if the SQLLogin was granted db_owner of master DB it was able to correctly resolve this linked server. But for other SQLServer to SQL Server linked servers using SQLNCLI, MSOLEDBSQL, MSOLEDBSQL19 it needs to be given sysadmin permissions.
Tried many approaches to this but fundamentally the issue remains. When using a SQLLogin there isn't a mapping to the remote login via linked server. Placing an explicit impersonate or explicit mapping for that user doesn't work either.
EDIT2: This does not seem to be a bug due to upgrading the SQL server. It's also repeatable on a server that was freshly built using SQL2025.
•
u/AutoModerator Mar 29 '26
After your question has been solved /u/drn101, please reply to the helpful user's comment with the phrase "Solution verified".
This will not only award a point to the contributor for their assistance but also update the post's flair to "Solved".
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/vitiris Feb 25 '26
When we saw this, the account existed at the database level but was missing at the server level. Remove account from database, add to server, and map back to database.
2
u/Type-21 Feb 25 '26
We have the same problem with a new VM. On the old VM it used to work flawlessly. The only thing we found was: if you give the account admin rights, it suddenly works. We have no idea why. Our plan is to ask our service provider next. Admin rights were never needed for linked server reads before..
1
u/Parallelo_Sam Feb 26 '26
I just went through this exact same thing on a managed instance this week. What fixed it for me was recreating the linked server and specifying the user in the provider string. So mine was ApplicationIntent = ReadOnly; User ID = user account. You might not need the ApplicationIntent part as I was using that to connect to the read only replica of a business critical managed instance.
2
u/SnooTigers4293 May 11 '26 •
I'm running into this now. Do you think its this? https://learn.microsoft.com/en-us/sql/sql-server/sql-server-2025-known-issues?view=sql-server-ver17#linked-server-queries-that-use-msdasql-fail-with-error-7416
1
u/AutoModerator Feb 25 '26
After your question has been solved /u/drn101, please reply to the helpful user's comment with the phrase "Solution verified".
This will not only award a point to the contributor for their assistance but also update the post's flair to "Solved".
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/FishBones83 Feb 25 '26
Try this, I use this tool a lot for troubleshooting connectivity issues:
https://github.com/microsoft/CSS_SQL_Networking_Tools/wiki/SQLCHECK
its an exe you run on the machine you're trying to reach, it doesnt install anything it just checks logs and produces a single text document. I suspect this is an SPN issue and SQL check will tell you the state of your SPNs among other things.
1
u/Jordanski_23 Apr 09 '26 •
hi, we had same issue. Try to remove provider from linkserver definition - it worked for us
1
u/Mr_Danderfluff May 14 '26
We also had this issue when going from 2019 to 2025, our process involved spinning up a new 2025 server, copying all the server stuff (databases, server objects, agent jobs, security etc) and then renaming both servers so the 2025 server became production and we had the 2019 server to reference.
We used to have SQLNCLI provider in our linked server connections which according to Microsoft:
SQLNCLIis used. UsingSQLNCLIwill redirect SQL Server to the latest version of SQL Server Native Client OLE DB Provider. The OLE DB provider is expected to be registered with the specified PROGID in the registry. Instead ofSQLNCLI,MSOLEDBSQLis recommended.which means our 2019 sql server just defaulted to the latest provider. We decided to drop and recreate the connections to explicitly use the MSOLEDBSQL provider for the linked servers and modify our provider strings to include the user
User id was included because Microsoft mentions this in the documentation:
If you run
sp_addlinkedserverfrom a local login, or a login that isn't part of the sysadmin role, you might receive the following error:Output
To resolve this issue, add the
User IDparameter to your connection string. In the following example,myUseris the User ID passed to the connection string:This is the link to said documentation:
https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql?view=sql-server-ver17
our version added a few extra provider string parameters needed and we wanted to be explicit with the provider.
EXECUTE master.dbo.sp_addlinkedserver
\@server = N'LinkServerName',
\@provider = N'MSOLEDBSQL',
\@srvproduct = '',
\@provstr = N'SERVER=serverName\InstanceName;User ID=myUser;Encrypt=No;TrustServerCertificate=yes';
EXECUTE master.dbo.sp_addlinkedsrvlogin
\@rmtsrvname = N'LinkServerName',
\@locallogin = NULL,
\@useself = N'False',
\@rmtuser = N'myUser',
\@rmtpassword = N'*****';
in ssms you can go to your linked server objects and script the linked server as a drop and create sql statement
where the script can server as rollback of your current linked server definition and then you can take a copy of the script and modify the sp_addlinkedserver and sp_addlinkedsrvlogin commands as needed using the above as reference for adding User Id.
As a side note:
our server is on prem & one of our jobs that used the linked servers started failing with the login-mapping error. This was after we started including User Id and we could run the exact same query the job would run in ssms (logged in with the same user context the job would run as).
our old server (2019) had Named Pipes Disabled (Sql Server Configuration Manager > SQL Server Network Configuration > Protocols for MSSQLSERVER)
We decided to try enabling named pipes on the 2025 server and if fixed the issue. In case anyone else has this unique scenario.