Express setup of a FTP server on Azure virtual machine

Here's a quick guide to setup a passive FTP Server with Windows Server 2012 R2 on a virtual machine hosted on Microsoft Azure with the "Ressource Manager" deployment model.

To stay simple I will not use SSL.

Step 1 : Install the FTP service on Windows Server 2012 R2

Open a powershell window and enter the following commands:
Install-WindowsFeature Web-Server –includeallsubfeature
Install-WindowsFeature Web-FTP-Server –includeallsubfeature


This will install IIS service, FTP service and management tools.

Step 2 : Publish the FTP site

To start using the FTP service you must publish it.

Run "inetmgr" to open "Internet Information Services (IIS) Manager":

Go to "Sites" the right clic the default web site and select "Add FTP Publishing...":


Select "No SSL":

Check "Basic", set access to "All users" and check permissions:

Publishing is done.
From the Azure portal get the IP of the running virtual machine:
IMPORTANT : if you stop your VM and reboot it later you'll have to update the IP used for next setting

On inetmgr select the server (not the default site) then "FTP Firewall Support":

Provide the IP retrieved from the Azure portal, set data channel port range to "1035-1040" and apply:

Step 3 : Open windows firewall

Open a powershell window and enter:
netsh advfirewall set global StatefulFtp enable
Then you need to restart the FTP service for all changes to apply:
net stop msftpsvc
net start msftpsvc



Step 4 : Set inbound security rules in Azure 

In the Azure portal go to the corresponding "Network Security Group", in the settings go to "Inboud security rules":


Add two rules, one for port 21, and one for port range 1035-1040:

Step 5: Test the connection

On your computer use a FTP client such as FileZilla, use the VM's IP and login/password used to open remote desktop (RDP):

You're done :)

Comments