Azure Data Factory · Permissions

SqlFailedToConnect: “Cannot connect to SQL Database” in Azure Data Factory

The integration runtime could not open a connection to the database. The message that follows says why: the server’s firewall refused the runtime’s IP address, the login was rejected, or public network access is switched off. Fix the one that applies.

The error, as it appears
ErrorCode=SqlFailedToConnect,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Cannot connect to SQL Database: 'sales-sql.database.windows.net', Database: 'sales', User: 'adf_loader'. Check the linked service configuration is correct, and make sure the SQL Database firewall allows the integration runtime to access.,Source=Microsoft.DataTransfer.ClientLibrary,'
Cannot open server 'sales-sql' requested by the login. Client with IP address '20.42.3.14' is not allowed to access the server.
Login failed for user 'adf_loader'.

What this error means

SqlFailedToConnect is raised before any query runs. The message repeats the server, the database and the user from the linked service, and then adds the error the database returned. That inner error tells the cases apart; the second and third lines above are two of them.

Microsoft’s guide lists them: Client with IP address ... is not allowed to access the server is the Azure SQL firewall, Login failed for user is a credential or permission problem, SqlErrorNumber=47073 means public network access is denied, and an unstable network can produce the same code now and then.

Why it happens

  • The firewall does not admit the integration runtime. The Azure integration runtime connects from a range of Azure IP addresses. If the server admits only named addresses and the setting that allows Azure services is off, the connection is refused.
  • The login was rejected. A password or secret was rotated, a login was disabled, or the service principal or managed identity was never added as a user of this database.
  • Public network access was switched off. The server now accepts private endpoints only, so the Azure integration runtime can no longer reach it. The error then contains SqlErrorNumber=47073 or the code SqlDeniedPublicAccess.
  • A self-hosted runtime cannot reach the server. For an on-premises or private server, port 1433 is closed somewhere between the runtime’s machine and the database.

How to fix it

  1. Read the inner message

    Open the failed activity’s error and look past the first sentence for Client with IP address, Login failed for user, 47073 or The server was not found.

  2. Test the connection from the linked service

    In Manage, open the linked service and select Test connection, with the same integration runtime the pipeline uses. It returns the same inner message without running the pipeline.

  3. For a firewall refusal

    On the SQL server’s Networking page, allow Azure services and resources to access the server, or add the address range of your integration runtime, or use a managed virtual network with a private endpoint. The first option admits connections from any Azure subscription, so it relies on strong logins. Firewall changes can take up to five minutes to apply.

  4. For a rejected login

    Check that the secret in the linked service, or in the Key Vault secret it refers to, is current. For a service principal or managed identity, create the database user and add it to the roles the copy needs.

    Azure SQL: add the factory’s managed identity as a database user
    01CREATE USER [my-data-factory] FROM EXTERNAL PROVIDER;02ALTER ROLE db_datareader ADD MEMBER [my-data-factory];
  5. For denied public access

    Use a managed virtual network integration runtime with a private endpoint, or set public network access to selected networks. Then rerun the pipeline.

How to stop it coming back

  • Prefer a managed identity to SQL passwords and client secrets, so there is no secret to expire.
  • Keep secrets in Azure Key Vault and refer to them without a fixed version, so a rotated secret is used from the next run.
  • Tell the data team before changing a server’s networking. One firewall change breaks every pipeline that reads from the server.

With PipelineMender AI

The next failed run explains itself.

PipelineMender reads the failed activity’s error and the pipeline definition with the Reader role on the factory. For this failure the evidence is the inner database error, so the report quotes it, states whether it points at the firewall, the login or network access, and lists the change for you to review.

Is the error in front of you now? Start a trial, choose Report an incident and paste it in. No connection is needed for that.

  • Read-only access
  • You review every change
  • No model training

Questions

Common questions about this error.

Why did it work yesterday and fail today without any change to the pipeline?

Because something outside the pipeline changed: a firewall rule, a rotated password or expired secret, a disabled login, or the server’s public network access setting.

Which IP address should I allow?

The address in the error is the one the integration runtime used for that attempt, and the next run may use another. Allow the published address range of the Azure integration runtime in your region, allow Azure services, or use a private endpoint.

Does the same code appear in Microsoft Fabric?

Yes. Fabric Data Factory reports the same SqlFailedToConnect code. Its message says connection where Azure Data Factory says linked service.

Checked against: Troubleshoot the SQL connectors (Azure Data Factory) Azure SQL Database IP firewall rules Troubleshoot common connection errors in Azure SQL Database Azure integration runtime IP addresses Copy data to and from Azure SQL Database Store credentials in Azure Key Vault

Last reviewed 13 November 2026 against Microsoft’s documentation. PipelineMender AI is an independent product and is not affiliated with Microsoft or Databricks; product names are trademarks of their owners.