☁️

Azure

2 notes  •  Cloud Computing

Configure FTP Ports on Azure VMs

Azure VMs block non-standard ports by default. To allow FTP (active and passive), you need to open the relevant ports in the Azure Network Security Group (NSG) and configure them in the FTP server.

Step 1 – Open FTP ports in the Azure NSG

  1. Go to the Azure Portal → Virtual Machines → select your VM.
  2. Under Settings, click Networking.
  3. Click Add inbound port rule and add:
    • TCP port 21 (FTP control)
    • TCP port range 1024–65535 (passive mode data transfer) — or restrict to a specific passive port range configured in your FTP server.

Step 2 – Configure passive ports in vsftpd (example)

Edit /etc/vsftpd.conf:

pasv_enable=YES
pasv_min_port=40000
pasv_max_port=40100
pasv_address=YOUR_PUBLIC_IP

Open ports 40000–40100 in the NSG (matching the range above), then restart vsftpd:

sudo systemctl restart vsftpd

Note

For production use, prefer SFTP (SSH File Transfer Protocol on port 22) over plain FTP — it's encrypted and requires only port 22 to be open.

Azure CLI Quick Reference

Common Azure CLI commands for authentication, subscription management, and VM operations.

Authentication

# Log in (opens browser)
az login

# Log in with service principal (for scripts/CI)
az login --service-principal -u APP_ID -p PASSWORD --tenant TENANT_ID

Subscription management

# List all subscriptions
az account list --output table

# Switch to a specific subscription
az account set --subscription "424c5082-2f7b-4849-bac7-263f0d0e76b4"

# Show current active subscription
az account show

Virtual Machine operations

# List all VMs in all resource groups
az vm list --output table

# Start a VM
az vm start --resource-group DEEPLEARNING --name h100instance

# Stop (deallocate) a VM — stops billing for compute
az vm deallocate --resource-group DEEPLEARNING --name h100instance

# Get VM public IP
az vm list-ip-addresses --resource-group DEEPLEARNING --name h100instance --output table

# SSH into a VM
az ssh vm --resource-group DEEPLEARNING --name h100instance

Resource groups

# List all resource groups
az group list --output table

# Create a resource group
az group create --name MyGroup --location eastus