High severitycredentials
Power BI Refresh Error:
SftpInvalidSftpCredential
What does this error mean?
Authentication to the SFTP server failed. The username/password or SSH key in the ADF linked service was rejected by the SFTP server.
Common causes
- 1The SSH private key stored in Azure Key Vault is not correctly base64 encoded — the entire original key file must be base64 encoded (not just the key content)
- 2The SSH private key is in PKCS#8 format (starts with '-----BEGIN ENCRYPTED PRIVATE KEY-----') which is not supported — it must be converted to traditional RSA format
- 3The SFTP username or password is incorrect
How to fix it
- 1If the private key is from Azure Key Vault: base64-encode the entire original private key file and store the encoded string in Key Vault
- 2In Python: import base64; keyContent = open(key_path, 'rb').read(); print(base64.b64encode(keyContent))
- 3In C#: string keyContent = Convert.ToBase64String(File.ReadAllBytes(keyPath), Base64FormattingOptions.None)
- 4If the private key is in PKCS#8 format (starts with '-----BEGIN ENCRYPTED PRIVATE KEY-----'): convert to traditional RSA format using: openssl pkcs8 -in pkcs8_key.pem -out rsa_key.pem && chmod 600 rsa_key.pem
- 5After converting, base64-encode the converted file before storing in Key Vault
- 6If the key file can be uploaded directly (not via Key Vault), uploading the original file via the SFTP connection UI works without base64 encoding
- 7For credential validation, test the key file or password using WinSCP with the same SFTP server