Serverless in Sea… in Azure!

manu rink
3 min readNov 3, 2016

--

Azure as a cloud service provider offers a service called “Azure Functions”. A function app is an easy to create application which can contain a bunch of functions — or endpoints. The function itself has a defined trigger and input/output bindings. With this feature set it can act as a web server providing defined endpoints for an API — without setting up this web server. After creating the function it is already available to you. And it grows and shrinks according to it’s challenge — when you want it to. Everything in place for your modular backend infrastructure or a microservice. Great!

But this is all very theoretical. Let’s see it in action. When you open the Azure portal just search the marketplace for “Function”. You will find the “Function App”. Just hit the “Create” button at the bottom of the description page.

You will be prompted the following dialog where you can choose a name for the function app and add it to a resource group. If you have already an application where you want to add this function just use an existing resource group. In any other case just create a new one. Hit the “Pin to dashboard” checkmark to attach the then deployed app to your dashboard. Then just attach the service plan and the storage and hit the “Create” button on the bottom again.

Now your app is being deployed. When you have a look at your dashboard, you see the process running. As soon as the deployment is done, the function app is visible on the dashboard. And guess what — it’s already running! This was all it took to provision and deploy a web server. For me as a mostly frontend developer this is pure magic :D

What we have to do now is to create a function — or endpoints. So open the function and you will see the following welcome and ramp up page.

Just select Webhook + API, choose your most favourite language and hit “Create this function”. What happens now is that the function is created which will be accessible to you as a HTTP endpoint. And as soon as this is done, it’s already up and running, executing the dummy code which is provided in there for you to instantly get started.

When you copy the URL, which is shown in the Function URL field and paste it to your browser it will already answer to you, that you have to attach a name — the behaviour which is defined in the else condition of the example function. And as soon as you add a “&name=Manu” to the URL, you get a warm “Hello Manu” from your endpoint.

So this was all it takes to get a web server up and running, make it available to the interwebz ;) and expose an endpoint which executes a function within this service. Now enter your own function code and to all the magic things!

--

--

manu rink

useful thingies and stories about the funs and pains being a iOS coder and cloud fan. and a girl. and a nerd. and a technical evangelist @Microsoft.