Azure Functions, I want to fetch files from SFTP, fixed IP, with certificate protections.

Azure Funcitons

Today I want to access files on SFTP, protected by fixed IP and certificates using Azure Functions.

Trigger this fetch periodically.

First I want to make sure I am accessing from the correct IP address as the IP address must be a specific one to access the SFTP.

// Get the IP  
string hostName = Dns.GetHostName(); // Retrive the Name of HOST  
string myIP = Dns.GetHostEntry(hostName).AddressList[0].ToString();

This will get my IP and print it out on the console when I test.

Next is setting up a private key, as the public key is stored on the other end of the server.

The public key has been generated using Azure Key Vault. I was looking for a way to connect Azure Key Vault and Azure Functions but seems pretty complicated. I want to look into this later but for now, I will download the private key and use this.

Published: 2021-08-30