500 I won’t open a connection to x.x.x.x (only to y.y.y.y)

When connecting to FTP server from a remote server hosted in Microsoft Azure i get error

500 I won’t open a connection to x.x.x.x (only to y.y.y.y)

This is because you are behind NAT firewall and trying to use FTP in Active mode.

To fix the error, enable FTP passive mode with command

ftp