Share via

SFTP Linked service using Public & Private Keys

Madhukar Muddasani 10 Reputation points
2025-11-18T17:13:54.4733333+00:00

Hello, Trying to create a SFTP linked service using " SSH Public key Authentication "and getting errors.

One of the errors I am receiving is 'Invalid Sftp credential provided for 'SshPublicKey' authentication type.Invalid private key file.'.Checked the keys multiple times and still receiving connection errors.

Thanks

Madhukar

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.


2 answers

Sort by: Most helpful
  1. Anonymous
    2025-11-18T19:06:26.61+00:00

    Hi @Madhukar Muddasani
    Welcome to Microsoft Q&A and thank you for posting your question.

    The error Invalid Sftp credential provided for 'SshPublicKey' authentication type. Invalid private key file. usually occurs when the SSH private key format or configuration does not meet Azure Data Factory (ADF) requirements for SFTP linked services.

    Common Causes and Fixes

    Private Key Format Ensure your private key is in the correct format (OpenSSH or PEM) and includes the proper header and footer lines. ADF does not accept PuTTY .ppk files. Convert .ppk to OpenSSH using PuTTYgen or ssh-keygen.

    Passphrase Keys encrypted with a passphrase are not supported. Remove the passphrase using: ssh-keygen -p -f id_rsa

    Key Vault Secrets If storing the key in Azure Key Vault, upload the entire private key file as a base64-encoded secret. Avoid escaping newlines or adding BOM.

    Public Key Verification Verify that the public key has been correctly added to the SFTP server’s authorized_keys. Test connectivity from the same Integration Runtime machine using: sftp -i id_rsa ******@sftp.example.com

    Permissions Check the permissions of the key files and ensure they are accessible by the service.

    Networking and IR Ensure outbound TCP/22 is allowed from your Integration Runtime host. Use Self-hosted IR if the SFTP server is in a private network or requires IP allowlisting.

    If the issue persists, please provide more details about the error messages and the configuration you are using.

    Official Documentation

    if still issue persist, please share required details in private message

    0 comments No comments

  2. Diksha 1,236 Reputation points
    2025-11-18T18:00:23.9833333+00:00

    Ensure that your private key is in the correct format (PEM) and not encrypted with a passphrase. Also, verify that the public key has been correctly added to the SFTP server. If the issue persists, check the permissions of the key files and ensure they are accessible by the service. If you still encounter problems, please provide more details about the error messages and the configuration you are using.


Your answer

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