Connectivity from Azure Data Factory to SFTP via NAT Gateway fails

Pratima Patil 50 Reputation points
2025-03-17T12:31:21.68+00:00

I have to reach to the client sftp through my adf linked service. Client needs a single static ip to whitelist on their end.

I created a SHIR within adf in a subnet that further is associated with a NAT gateway public ip.

I requested the client to whitelist my nat public IP.

I logged in to the VM, search for 'whats my ip?' It shows the nat gw IP.

But still my linked service fails.

Tracert / ping/ tcpping nothing works.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,639 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Amira Bedhiafi 33,631 Reputation points Volunteer Moderator
    2025-03-17T16:35:17.55+00:00

    Hello Pratima !

    Thank you for posting on Microsoft Learn.

    When dealing with connectivity issues between ADF and an SFTP server via a NAT Gateway, there are several potential points of failure to investigate :

    • Verify that the NAT Gateway is correctly associated with the public IP address that the client has whitelisted.
    • Verify that the subnet where the Self-hosted Integration Runtime (SHIR) is deployed is correctly associated with the NAT Gateway.
    • The SHIR VM must be correctly configured to use the NAT Gateway for outbound traffic. This typically involves ensuring that the VM’s subnet is associated with the NAT Gateway.
    • Verify that there are no firewall rules on the SHIR VM that might be blocking outbound traffic to the SFTP server.
      • Outbound Rules: Check the NSG associated with the subnet of the SHIR VM to ensure that outbound traffic to the SFTP server’s IP and port (usually port 22 for SFTP) is allowed.
    • Although not directly related to outbound traffic, ensure that there are no restrictive inbound rules that might be affecting the SHIR’s ability to communicate.

    Example Commands for Testing Connectivity

    
    # Test DNS resolution
    
    nslookup <sftp-server-hostname>
    
    # Test connectivity to SFTP server on port 22
    
    tcpping <sftp-server-ip> 22
    
    telnet <sftp-server-ip> 22
    
    # Manual SFTP connection test
    
    sftp -P 22 <username>@<sftp-server-hostname>
    
    

  2. Chandra Boorla 14,665 Reputation points Microsoft External Staff Moderator
    2025-03-19T01:06:16.19+00:00

    @Pratima Patil

    I understand you're experiencing issues connecting to the SFTP server, as indicated by the error code: SftpFailedToConnectToSftpServer. Here are some troubleshooting steps that might help you:

    Firewalls and NSG Configuration - Check NSG Rules: Ensure that the NSG rules allow traffic to the SFTP server. Source: Any Source Port Ranges: * Destination: SFTP Server IP (ensure it’s correctly configured) Destination Port Ranges: 22 (the default for SFTP) Action: Allow Priority: Make sure it has a higher priority than any deny rules.

    Server Status Verify Server Availability - Ensure that the SFTP server is up and running, and check if there are any known outages or maintenance activities.

    Protocol and Configuration Protocol Check - Confirm that the SFTP protocol is correctly implemented on the server. Binary Data Issue: The error suggests a potential issue with reading binary packet data. Verify that the server configuration aligns with the client’s expectations for data transmission.

    Logs and Additional Diagnostics Check Server Logs - Look for any relevant logs on the SFTP server that might give additional details on the connection issue. Activity ID: Use the Activity ID (9d8c4406-e17f-43f5-aa0a-3017cde2a543) for reference during support calls or further investigation.

    Testing Tools Use SFTP Client - Try connecting to the server with a different SFTP client (such as FileZilla or WinSCP) to rule out client-side issues.

    For additional information please refer the following link for some useful insights.

    Additionally, you may refer to the below similar threads:

    I hope this information helps. Please do let us know if you have any further queries.

    Kindly consider upvoting the comment if the information provided is helpful. This can assist other community members in resolving similar issues.

    Thank you.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.