ftp.exe doesn’t work in Azure – Fail to send PORT command in FTP with NAT – 500 Illegal PORT command.

Well this was such a journey for me, and when I read the answer from Microsoft support I thought, I really need to blog on this.

One application, maybe a old one, was using ftp.exe commands to execute some operations, at some point it needed to be migrated in Azure.
People asked me to investigate to an issue, the ftp.exe command was able to log to cddis.gsfc.nasa.gov but, after that, no way to execute ftp commands from the Azure VM, for example like the ls command, see below.

I tried many different tests, disabling firewalls, NSG, trying different OS etc…
The curious thing for me was the fact that the same command was able to work from another Windows Server and my laptop (both not in Azure).
See below the same command running on my laptop

At some point I raise a request to the Microsoft support using the portal, something I recommend to use for any EA customer, they are really good and fast.

I report the official answer for any benefit.

“Thank you for contacting Microsoft Support. My name is XXXXXXXXXXX.  I am the Support Professional who will be driving this Service Request forward.
You may reach me using the contact information listed below in my signature, referencing the SR number: 123123123123.
My understanding is that you are unable to execute commands in your FTP site.
We will consider the case resolved once we have been able to help you achieve the same.
We will now begin working together to resolve your issue. If you do not agree with the scope defined above, or would like to amend it, please let me know as soon as possible.

I have reviewed on your concerns and based on my findings, below are my responses:
I understand that you configured Active FTP  in Azure and is unable to executes commands. Active FTP is not supported in Azure environment, also the default Windows command line

ftp.exe, doesn’t work in Azure. The command tends to initiate an Active connection and refers to  the private IP of the client VM (VM Name LXX-XXX-C02, DIPs 10.XXX.XXX.11),
whereas trying to initiate a connection to a public IP and thus fails.

Kindly refer to this link for more information. ”

I think the statement “ftp.exe, doesn’t work in Azure.” is something really important to know, how to solve this?

You can easily use other tools like Winscp.

I hope this can help.

Related blog posts