Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

SFTP - SSH Connector - Invalid private key file

Hello Community,


I have come to a head. The SFTP - SSH connector does not seem to be accepting any valid private keys.


provided host, private key in the same format described on this page and this page, I receive and error everytime


Invalid private key file


The connection works in Filezilla and other sftp clients. Power Automate is the only place where this setup is not working.


I have attempted using the username in the SSH passphrase

I have attemopted encrypting with a pasphrase

I have attempted enabling Disable SSH host key validation


Any help would be greatly appreciated. 


link to a screenshot 


Accepted Solutions

After many failed attempts I was finally able to make an SSH connection from Flow following the above message.


You have to create the SSH connector while creating a Flow, don't try to add the connector first.



View solution in original post

Community Support
Community Support

Hi @liveopsBI ,


Could you please share a screenshot of the configuration of the connection?


Best regards,


Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Frequent Visitor

Anyone have any experience with a successful use of ssh key with the sftp-ssh connector?

My issue is similar to this comment


my issue is similar in that I too am using AWS Transfer. 


This is from that blog post that gets referenced on this forum quite a bit. The blogger's reply is revealing - 


You raise a good question. There is definitely something amiss with SFTP interop between Power Automate and the AWS Transfer for SFTP service. I was able to reproduce the same issue as you. I can connect to the AWS Transfer service using key based auth from both WinSCP (ppk formatted) and a Linux machine (OpenSSH formatted, using the sftp command) without issue, but an SFTP connection using the same keys fails from Power Automate.

Another interesting data point is that Power Automate CAN connect via SFTP (using key-based auth) to AWS EC2 Linux instances.

I recommend raising a ticket to the Power Automate team about this one ( --> Contact Support, note URL may vary by region). At the very least, I am hoping support can provide a more specific error message.

The product issue mentioned in the previous comments is old (and resolved) but this may be a new one. The old product issue for reference and since I removed it from this post was:

Around October/November 2018, there was a product issue with Flow that prevented creating SFTP connections that use private keys (regardless of the formatting considerations described in this post). In this case, it had to do with Flow's front end handling of multi-line text. This was partially addressed by the Flow team the week of November 12, 2018; by "partial resolution" I mean that it was still necessary to use the correct method to create an SFTP connection in Flow. 1 way worked, another did not.

Creating an SFTP connection (key based auth) from within the Flow editor (after adding an SFTP action to a flow) WORKED

Creating an SFTP connection (key based auth) from Settings -> Connections DID NOT WORK.

I am interested to hear if Microsoft comes back with anything. Good luck and I hope you are able to get the issue resolved. Thanks again!



Is anyone from Microsoft working on this?


Is there anyone who has had success using a SSH key from a SFTP service hosted on AWS using the SFTP-SSH connector?

After many failed attempts I was finally able to make an SSH connection from Flow following the above message.


You have to create the SSH connector while creating a Flow, don't try to add the connector first.



I am not able to see the solution.  It would be MUCH appreciated if you can re-post or elaborate how you overcame this issue.  I am connecting to AWS Transfer SFTP server as well

Posted at midnight.. I know what that's like. 


The solution is-

  • Create the connector while you in the flow designer view,
  • choose any SFTP-SSH connector trigger or action
  • If you have never set one up, it will show in the correct view, otherwise, select the three dots and select add connection
  • setup the connection in that view, be sure to specify the S3 bucket name as a part of the root folder path, specify your port (22), and disable SSH validation

If you mess up, the connection will be saved either way, and be stored in the connections list until you delete it, so try to get it right the first time, and if you get it wrong, it may be prudent to clean as you go. 

i am following your steps, but i get a BadGateway error still, do you know what a i ma doing bad?

Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Kudoed Authors
Users online (2,742)