Serverless technology is the latest trend in enabling developers to build pieces of functionality by providing a clean interface to build against and a seamless way to deploy without needing to involve the Operations or Infrastructure teams. This article walks through a couple of decisions you will need to make to get your first serverless app running the way you want in Azure Functions.
Introduction to Azure Functions as a Serverless Platform
For the purposes of this post, I’m assuming you know the basics of serverless architecture and are interested in seeing how much actual effort is involved to stand up a basic serverless app.
Why use Azure Functions? It is based on open source code available on GitHub. It lets you pick from one of several languages, including C#. It has native integration with Visual Studio for all those shops that already extensively leverage Microsoft’s development toolkit (like SharePoint or Dynamics) for other purposes. It is well documented and supported. And to make it more cost effective to develop on, it only charges when code is actually being executed, on top of having up to the first one million requests for free.
One of the biggest benefits of Azure is how flexible it is and how much automation you can build around it. This is also a big downfall if you are used to more limited public clouds like Digital Ocean, or public clouds with a lot more pre-packaged examples, like AWS.
Using Windows or Linux for the Server/Hosting OS
Unlike other serverless platforms, Azure lets you select what OS your function will run on in their cloud. The default is Windows, and for most purposes, the OS doesn’t really matter, but if you need Linux, then you need Linux.
The vast majority of Microsoft’s documentation and examples leverage the web portal, and if you are more comfortable using the Web than the command line, you will need to stick to Windows as the OS. Visual Studio integration also works best using Windows as the server-side OS. The guidance to create your first function on Azure is available in Microsoft’s extensive online documentation.
If you do choose to go the Linux route, then you can only use the command line at this point in time. The command line is extremely powerful and directly accesses the API, which also powers the web portal. It can be used on Windows, Linux, and MacOS. Using MacOS as a client works for the vast majority of things, but you will find that some commands don’t seem to have all the flags that the documentation advertises. Microsoft Azure’s article on how to create your first function on Linux walks through all the steps required.
Which Development Language to Use
In the production version of the Functions engine (version 1.x), Azure Functions fully supports C#, JavaScript, and F#. Python, PHP, Bash, Batch, TypeScript, and PowerShell support is there, but is considered experimental.
In the current iteration of the next generation (2.x) of Functions (which is not considered production ready), there is support for C#, JavaScript, and Java.
C# and JavaScript are the current best options. With the deep integration Azure has with Visual Studio and the popularity of JavaScript (Node.js), the choice will come down to either personal preference, or a mandate from the project you are working on.
Options for Triggers to Activate a Function
The triggers available to launch your serverless app in Functions are the standard set if you have done some work in this space before. A function can only use a SINGLE trigger to launch it.
Current Triggers
As a side note, Triggers are technically just a special type of binding, and Microsoft is working to expand the available bindings in the newer version of Functions (2.x), including integration with Office 365 apps.
Summary
More information on the official roadmap for Azure Functions is publicly available.
As you can see, Azure Functions can be quick and easy to get started with—Or they can be as complex as you want by using an experimental language using the command line. The platform is as flexible and powerful as any other provider on the market and will be especially interesting to any development teams who already have an investment or interest in Microsoft’s development platform and enterprise products.