MSSQL on Linux: Could not connect to server because it is not defined as a remote login at the server

Microsoft.SQLServer.Linux.EventRule.DBEngine.Could_not_connect_to_server_because_it_is_not_defined_as_a_remote_login_at_the_server_1_5_Rule (Rule)

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.

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 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 the Docs Online (Updated - SP3) topic, "Renaming a Server," 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.

Overridable Parameters

Name

Description

Default Value

Enabled

Enables or disables the workflow.

Yes

Interval (seconds)

The recurring interval of time in seconds in which to run the workflow.

300

Priority

Defines Alert Priority.

1

Severity

Defines Alert Severity.

1

Synchronization Time

The synchronization time specified by using a 24-hour format. May be omitted.

 

Timeout (seconds)

Specifies the time the workflow is allowed to run before being closed and marked as failed.

200

Timeout for query execution (seconds)

The workflow will fail and register an event, if the query execution takes longer than the specified period.

60

Timeout for database connection (seconds)

The workflow will fail and register an event, if it cannot access the database during the specified period.

15

Element properties:

TargetMicrosoft.SQLServer.Linux.DBEngine
CategoryEventCollection
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
MSSQL on Linux: Could not connect to server because it is not defined as a remote login at the server
{2}
CommentMom2017ID='{9CF46B83-7BD2-49D5-A987-B24FCB6FD0D7}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

ID Module Type TypeId RunAs 
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ DataSource Microsoft.SQLServer.Linux.DataSource.EventCollectionFiltered Default
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<Rule ID="Microsoft.SQLServer.Linux.EventRule.DBEngine.Could_not_connect_to_server_because_it_is_not_defined_as_a_remote_login_at_the_server_1_5_Rule" Target="SqlDiscL!Microsoft.SQLServer.Linux.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2017ID='{9CF46B83-7BD2-49D5-A987-B24FCB6FD0D7}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Microsoft.SQLServer.Linux.DataSource.EventCollectionFiltered">
<MachineName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</MachineName>
<NetbiosComputerName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</InstanceName>
<ConnectionString>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/ConnectionString$</ConnectionString>
<InstanceVersion>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Version$</InstanceVersion>
<InstanceEdition>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Edition$</InstanceEdition>
<SqlExecTimeoutSeconds>60</SqlExecTimeoutSeconds>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<TimeoutSeconds>200</TimeoutSeconds>
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<EventDisplayNumber>18483</EventDisplayNumber>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.Linux.EventRule.DBEngine.Could_not_connect_to_server_because_it_is_not_defined_as_a_remote_login_at_the_server_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</AlertParameter1>
<AlertParameter2>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</AlertParameter2>
<AlertParameter3>Event ID: $Data/Property[@Name='EventID']$. $Data/Property[@Name='Message']$</AlertParameter3>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>