Could not connect to server because it is not defined as a remote login at the server

Microsoft.SQLServer.2008.Could_not_connect_to_server_because_it_is_not_defined_as_a_remote_login_at_the_server_1_5_Rule (Rule)

Knowledge Base article:

Summary

Setting up security for executing remote procedure calls (RPC) against a remote server involves setting up login mappings in the remote server, and possibly in the local server running an instance of Microsoft SQL Server. The mapping is specific to a given server\instance name, usually the NetBIOS name for a default instance, and the NetBIOS name plus the instance name for a named instance. If the login mapping does not exist, or if the name of the server specified in the connection string does not match the exact name in the sysremotelogins table, and the guest account does not have a mapping in sysremotelogins, you will receive this error. You will also see this error, if the remote user is found to have a null or empty login name.

Resolutions

Replication uses remote server definitions to connect to the Distributor, Publisher, and Subscriber. At the time you enable and configure a replication, you implicitly create remote servers and add login mappings for those remote SQL Server instances. Replication connection strings will always specify the NetBios name for a default instance, and the NetBIOS name plus the instance name for a named instance. Therefore, replication will not find or use remote server names that were defined for IP addresses, or for fully qualified domain names. When the replication connection attempt cannot find the NetBIOS name in sysremotelogins, you will receive the above error.

Microsoft SQL Server replication is supported when the servers involved are registered by NetBIOS (network) name, but not when the servers involved are registered by IP address or fully qualified domain name. For more information about how to replicate between computers running SQL Server in non-trusted domains or across the internet, see Microsoft Knowledge Base article 321822.

Note Support for remote servers is provided for backward compatibility only. New applications that must execute stored procedures against remote instances of SQL Server should use linked servers instead.

If any of the servers involved in the query or used in replication have ever been renamed, or were created from an image, you must ensure that the NetBIOS (network) name matches the machine portion of SQL Server's @@SERVERNAME. If they do not match, you can follow the steps in “Renaming a Server” Books Online (Updated - SP3) topic to update the value of @@SERVERNAME. This change does require that you restart the SQL Server instance. For more information about why replication setup is not successful when SQL Server 2000 is deployed by using a disk image, see Microsoft Knowledge Base article 818334.

If this error occurs during replication, verify that you configured the Distributor, Publisher, and Subscriber using the NetBIOS (network) name, not the IP address or fully qualified domain name.

Overrideable Parameters

Name

Description

Default Value

Enabled

Enables or disables the workflow.

Yes

Priority

Defines Alert Priority.

1

Severity

Defines Alert Severity.

1

Element properties:

TargetMicrosoft.SQLServer.2008.DBEngine
CategoryEventCollection
EnabledTrue
Event_ID18483
Event Source$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
Could not connect to server because it is not defined as a remote login at the server
{0}
Event LogApplication
CommentMom2008ID='{9CF46B83-7BD2-49D5-A987-B24FCB6FD0D7}';MOM2008GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

ID Module Type TypeId RunAs 
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ DataSource Microsoft.Windows.EventProvider Microsoft.SQLServer.SQLDefaultAccount
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.2008.Could_not_connect_to_server_because_it_is_not_defined_as_a_remote_login_at_the_server_1_5_Rule" Target="SQL2008Core!Microsoft.SQLServer.2008.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2008ID='{9CF46B83-7BD2-49D5-A987-B24FCB6FD0D7}';MOM2008GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Windows!Microsoft.Windows.EventProvider" RunAs="SQL!Microsoft.SQLServer.SQLDefaultAccount">
<ComputerName>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$</ComputerName>
<LogName>Application</LogName>
<Expression>
<And>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>PublisherName</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>$Target/Property[Type="SQL!Microsoft.SQLServer.DBEngine"]/ServiceName$</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
<Expression>
<SimpleExpression>
<ValueExpression>
<XPathQuery>EventDisplayNumber</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value>18483</Value>
</ValueExpression>
</SimpleExpression>
</Expression>
</And>
</Expression>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="SystemHealth!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.2008.Could_not_connect_to_server_because_it_is_not_defined_as_a_remote_login_at_the_server_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>Event ID: $Data/EventDisplayNumber$. $Data/EventDescription$</AlertParameter1>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>