I have a number of Azure SQL databases that I would like to have access an external table in a local SQL Server database (not named instance). The local SQL Server table has a trigger that can send mail that I want to use since Azure SQL databases don't have mail capabilities that could send an email. Stored procedures in the Azure SQL databases would write to the local database and trigger the event.
I have done the following:
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'xxxx';
CREATE DATABASE SCOPED CREDENTIAL [SignalRxCredential]
WITH IDENTITY='normalLogon',SECRET='normalPassword'; -- SQL Server authentication
CREATE EXTERNAL DATA SOURCE [SignalRxDataSource]
WITH (
TYPE = RDBMS,
LOCATION = 'sqlserver://10.0.0.6',
DATABASE_NAME = 'staging',
CREDENTIAL = [SignalRxCredential]
);
CREATE EXTERNAL TABLE [dbo].[EmailNotifications_ext]
(
[MessageID] [int] NOT NULL,
[Subject] [varchar](255) NULL,
[Recipient] [varchar](255) NULL,
[SendFrom] [varchar](255) NULL,
[MessageText] [nvarchar](max) NULL
)
WITH (DATA_SOURCE=[SignalRxDataSource],SCHEMA_NAME=N'dbo',OBJECT_NAME=N'EmailNotifications')
It successfully creates the scoped credential and the external table but when I try to select records from it, I get this error:
An error occurred while establishing connection to remote data source: [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].
[Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired[Microsoft][ODBC Driver 17 for SQL Server]
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
I've double-checked the credentials and I'm connected to both the Azure SQL server and the local SQL Server is the same SSMS... so both databases are accessible via TCP/IP with SQL Server authentication. Named pipes is enabled and allow remote connections is checked on the local server.
What have I missed and what do I need to do to get this working?