SSH keys with Power Automate’s SFTP Connector

Power Automate’s SFTP connector is very useful for transferring files securely. But it can be finicky to set up SSH private key authentication, especially since every error with the connection is just reported as “Bad gateway”.

In this post: https://blog.neilsabol.site/post/microsoft-ms-flow-sftp-connector-tips-tricks-errors/, Neil Sabol shares a lot of information about the SFTP connector, including the private key formats that it accepts. The part that was still missing for me was how to convert the private key that I’d generated on my Mac to one that would work with Power Automate.

I created the keypair on my Mac with: ssh-keygen -b 4096 -t rsa

This created a private key that started with: -----BEGIN OPENSSH PRIVATE KEY-----

This key worked fine with FileZilla, but Power Automate’s SFTP connection didn’t like it. Maybe I could have created a new keypair with a different type after “-t”, but I had a working keypair that I wanted to use.

I was able to convert it to a private key acceptable to Power Automate with: ssh-keygen -p -f key-file-name -m pem

This results in a private key file that starts with: -----BEGIN RSA PRIVATE KEY-----

Copy that whole file and paste it into the “SSH private key” field in the Power Automate connection, and it works!

Leave a Reply

Your email address will not be published. Required fields are marked *