Private OpenFaaS in Microsoft Azure

I have some internal-only OpenFaaS functions that are doing some work for me on a schedule. I don’t need access to the gateway or web UI from the Internet so creating an Azure Virtual Machine (VM) and ssh-ing into it is more than sufficient. This is super cool because all of my functions are essentially locked down behind the VM firewall and can only talk to each other.

TL;DR: I have created a super basic convenience bash script that contains all of the commands I talk about below. You can find it here:

Let’s get started!

Create your Azure Virtual Machine

To start, you can create a VM in Azure by going to the menu on the left, clicking the green plus, and selecting Ubuntu Server 16.04 LTS VM. If that doesn’t show up by default for you, you can search for it.

I went with Ubuntu because it’s Linux and cheaper than a Windows VM. OpenFaaS works beautifully on Windows, OS X, and Linux so this decision was a matter of cost only.

When you click the link to create a new VM, you’re presented with the following:

Fill in the options as you need, and click “OK”

After clicking “OK”, you’re presented with a selector for VM size. There is a link that says “View All” that allows you to view all VM sizes, so by clicking that you’re given the option of much smaller and cheaper VMs. I picked a Basic 1 Standard (B1S) as it’s only $8.93 USD (as of this writing).

So cheap, yet so powerful!

On the next configuration page, you can pick some optional settings. The only thing I change here is the “Use managed disks” setting which I set to “No”, and then I allow Azure to create blob storage for my VM.

By taking the default settings here, our VM is given a network firewall which is very easy to configure, or, as we will do, leave it alone and block everything except SSH.

Click “OK” to complete that step, and again after the creation validation has completed and wait while the virtual machine is created and spun up.

Connect and install Docker Community Edition

Open up a terminal window and enter ssh username@ip_address_for_your_vm and then provide your password. Once logged in, you can install Docker with the following guide: Docker documentation

Basically, you uninstall any existing versions, update the apt package index, install a few pre-requisite packages, add the official Docker GPG key, add the Docker Ubuntu stable repository, and finally install Docker CE. I followed this guide and it worked perfectly. If you have any issues, feel free to message me on Twitter.

One more note: be sure to add your user account to the docker user group on your VM so you can issue Docker commands without having to use sudo. You can type sudo usermod -aG docker your-user , log off and back on, and you should be all set. You can verify this by typing docker --version and if you see output like Docker version 17.09.1-ce, build 19e2cf6, you’re good to go!

Install OpenFaaS

Finally, we’re ready to install OpenFaaS! I typically make a folder to hold my code, so you can issue the following commands to clone the FaaS repo and deploy the default OpenFaaS stack:

$ mkdir dev
$ cd dev
$ git clone
$ cd faas/
$ sudo ./

You can verify everything is working by typing: curl localhost:8080/function/func_nodeinfo -d '' which will post empty data to the nodeinfo function. This should return information about your virtual machine.

Lastly, install the OpenFaaS CLI by typing: curl -sSL | sudo sh

You’re ready now! If you need some help creating OpenFaaS functions or want more understanding of what’s going on or what we just did, or just want to say “Hi!”, stop by the official OpenFaaS GitHub repo, give it a star, and drop Alex an email with an introduction to join our Slack channel.