We have an ADF subscription that we are trying to create a linked service to an azure cloud based SQL Server on. We have an existing subscription that already has this linked service created and need it in another one.
When testing the connection for the SQL
Server, we get the following error message:
Cannot connect to SQL Database. Please contact SQL server team for further support. Server: ‘servername’, Database: ‘dbname’, User: ‘username’. Check the linked service configuration is correct, and make sure the SQL Database firewall allows the integration runtime to access.
A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 – An existing connection was forcibly closed by the remote host.), SqlErrorNumber=10054,Class=20,State=0,
An existing connection was forcibly closed by the remote host
The username, password, servername, db name are all correct (as they work in another subscription, have just removed them here) We are using a Self Hosted Integrated Runtime to make the connection between the two, which has had its firewall opened to allow a connection.
We are not seeing any denials on the firewall rules when attempting to connect, and no failed log in attempts or error logs on the SQL Server itself to say that the log in has been denied.
Can anyone recommend a way to fix it please?
2
I have seen that error when there are temporary issues with the Azure service for a region or for a small set of customers. On those cases Azure Status site does not report the issues with the services, and it may take up to 8 hours for the services to go back to normal. You can see the temporary issues affecting your database on the Resource Health option of your database left vertical panel on the Azure Portal.
Some customers have reported (here) starting to see error 10054 after Azure platform changes Azure SQL Database firewall without any notice. Can you verify the Azure SQL firewall for the database involved with these error 10054 is configured as the other databases that work as expected.
And some other customers also have reported that after scaling up the service tier of the database and then scale it down to where it was the error disappears.
The connection cannot be established even when using the correct server name, username and password, from one of the comments, the resource is an Azure SQL resource, probably the server is protected or missing a firewall rule that the pre-login recognizes but does not authorize to connect, you can use the Azure Portal, CLI or PowerShell, create the Azure SQL resource from scratch or just modify (add) a firewall rule to the existing one (look at the ADF properties to find the IP Address range), Azure Data Factory IP range is shared across Fabric Data Factory, IP addresses that Azure Integration Runtime uses depends on the region where your Azure integration runtime is located. All Azure integration runtimes that are in the same region use the same IP address ranges:
If we know the IP range we can use in PowerShell:
$serverFirewallRule = New-AzSqlServerFirewallRule -ResourceGroupName $resourceGroupName -ServerName $serverName -FirewallRuleName "AllowedIPs" -StartIpAddress $startIp -EndIpAddress $endIp
If we start from zero:
# Connect-AzAccount
$SubscriptionId = 'c93e...'
$resourceGroupName = "add resource group name"
$location = "view in Azure portal where your location is CentralUS, eastus,..."
#add your secret access
$adminSqlLogin = "add the user you added when deploying the server in Azure"
$password = "the password"
$serverName = "add the server name or unique url/ip to the server or endpoint"
#your script looks for the Deleted item or table
$databaseName = "thecompletedatabase"
# The ip address range that you want to allow to access your server
$startIp = "0.0.0.0"
$endIp = "0.0.0.0"
Set-AzContext -SubscriptionId $subscriptionId
#create all
$resourceGroup = New-AzResourceGroup -Name $resourceGroupName -Location $location
#create the server in azure
$server = New-AzSqlServer -ResourceGroupName $resourceGroupName -ServerName $serverName -Location $location -SqlAdministratorCredentials $(New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $adminSqlLogin, $(ConvertTo-SecureString -String $password -AsPlainText -Force))
#allow the firewall rule from the ranges
$serverFirewallRule = New-AzSqlServerFirewallRule -ResourceGroupName $resourceGroupName -ServerName $serverName -FirewallRuleName "AllowedIPs" -StartIpAddress $startIp -EndIpAddress $endIp
#create a new database S0 tier
$database = New-AzSqlDatabase -ResourceGroupName $resourceGroupName -ServerName $serverName -DatabaseName $databaseName -RequestedServiceObjectiveName "S0" -SampleName "dbo2024"
# Clean up deployment
# Remove-AzResourceGroup -ResourceGroupName $resourceGroupName
Then retry to add the connector in ADF once the firewall rule exists in the Azure SQL data source
jbsidis is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.