locked
SFTP Link Service - Invalid Sftp credential provided for 'SshPublicKey' RRS feed

  • Question

  • Hi All,

    As part of a project we need to be able to load files from an SFTP location using Azure Data Factory.

    I have the private key file .ppk from the SFTP host provider. I am able to use this ppk file in CoreFTP to connect and view and read these files.

    I have also used the Azure portal wizard to create a data factory that loads this private key file and this successfully connects to the sftp and loads the file.

    The source file has a number of header details that needs to be handled and to achieve this I need to crate a custom component. 

    I need to incorporate all the above in a solution. So create a library class project to handle the custom activity and a data factory project that references the class. So far so good! :-)

    The issue I have is creating a link service json to the SFTP site that authenticates successfully.

    I've gone through various references including the following

    https://docs.microsoft.com/en-us/azure/data-factory/data-factory-sftp-connector

    https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/data-factory/data-factory-sftp-connector.md

    Since we are using data factory as a VS project we need to handle the key content as a string in the Json link service not a file

    To create the key I used the client tool puttyGen. Steps i took were as follows. 1. Loaded the ppk file 2. Conversions - Export to OpenSSH key 3. Saved the file. 4. Open the file and copied the string (removing any carriage returns) into the json for the value privateKeyContent

    {

      "$schema": "http://datafactories.schema.management.azure.com/schemas/2015-09-01/Microsoft.DataFactory.LinkedService.json",
      "name": "Source-Sftp-xxx",
      "properties": {
        "type": "Sftp",
        "typeProperties": {
          "authenticationType": "SshPublicKey",
          "host": "sftp.xxxx.com",
          "port": 22,
          "username": "<my username>",
          "privateKeyContent": "<my key>",
          "passPhrase": "xxxx",
          "skipHostKeyValidation": true
        }
      }

    I then deploy the data factory. Unfortunately when it runs I get the following error

    Copy activity encountered a user error at Source side: ErrorCode=UserErrorInvalidSftpCredential,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Invalid Sftp credential provided for 'SshPublicKey' authentication type.,Source=Microsoft.DataTransfer.ClientLibrary.SftpConnector,''Type=Renci.SshNet.Common.SshException,Message=Invalid private key file.,Source=Renci.SshNet,'. 

    I can't seem to get round this after trying various settings.

    Has anyone tried this using the Json file to include the key as a string and have had success? If so please can you share with me the method you have used.

    Thank you for your time 

    John

     


    • Edited by Shiangoli Wednesday, July 19, 2017 2:08 PM
    Wednesday, July 19, 2017 11:38 AM