Primer on going serverless with Azure

What is serverless?

A good and concise definition can be found here:

“Serverless architecture is an approach that replaces long-running virtual machines with ephemeral compute power that comes into existence on request and disappears immediately after use.”


  • Reduced Ops because there are no (read strongly reduced) concerns about the actual technical infrastructure; making DevOps easier for developers
  • Automatic scaling; comes out-of-the-box for free.
  • Pay per compute; pay only for what you actually use.
  • Time to market is reduced.


  • Loss of control because updates to underlying infrastructure are automatic and could cause depended code problems
  • Scaling is automatic and could actually flood components in the system that are less capable of scaling.
  • Pricing is done per compute and could therefore spin out of control.

Serverless on Azure?

On Azure there are two offerings that are going to make serverless viable, namely Azure Functions and Logic Apps.

Azure Functions

Azure Functions are basically under the hood App Services, build on top of Webjob SDK and being run in their own Azure Functions run-time. They make it possible to write small and concise event triggered software components that run in these ephemeral containers which make it possible to only charge you for how long it takes for your code to run. Because they run in ephemeral containers, and there’s no worries about technical infrastructure, they can scale themselves automatically as needed.


Let’s make one.

Walkthrough creating an Azure Function


  1. First sign in to
  2. Click on the green plus sign
  3. Choose Compute
  4. Choose Function App


  1. Type in an app name (this will become part of the URL)
  2. Choose your subscription
  3. Choose or create your resource group
  4. Choose your hosting plan (Consumption Plan is dynamic billing and App Service Plan is static like traditional billing)*
  5. Choose your location
  6. Choose your storage account**
  7. Click on the blue “Create” button

* Choose wisely because you can’t change hosting plan afterwards!
** Will be used to store logs, etc.

Now find “my1stfunction” or whatever you called it in your resources and when you click on it you’ll see:


  1. Choose Webhook + API as scenario
  2. Leave language on C#
  3. Click on the blue “Create this function” button


By default it created “HttpTriggerCSharp1” this way, which is the actual function. As you can denote from the screenshot you can add multiple functions to one Function App. You start in the “Develop” pane where you see the actual code of the function. It starts you off with a short tutorial guiding you along the different panes which make up an Azure Function. For now let’s just copy the Function’s Url (see encircled in red), open up a new tab and paste it in. Then add at the end of the Url: &name=Danny. Because as you can see the default code expects a parameter in the querystring or the body with the key “name”. And when you hit enter you should see the following screen:


Logic Apps

Logic Apps are to developers what Microsoft Flow is to non-developers and also allows you to create business processes and workflows visually. But it has a lot more power than Microsoft Flow and opens up a world of opportunities. Logic Apps have originated more from integration concerns in enterprise environments and is part of the iPaaS offerings of Azure. It is considered part of the serverless offerings of Azure because it shared the same characteristics, being: No technical infrastructure concerns, scales automatically, pay for what you use.

Let’s create one.

Walkthrough creating a Logic App

  1. First sign in to
  2. Click on the green plus sign
  3. Choose Enterprise Integration
  4. Choose Logic App

  1. Type in a name
  2. Choose your subscription
  3. Choose or create your resource group
  4. Choose your location
  5. Click on the blue “Create” button

  1. Click “Logic App Designer”
  2. Click “When a new tweet is posted”

Logic Apps start processing with the help of triggers. Here we use a Twitter trigger, which will be fired each time a new tweet is posted with a certain tag:

  1. Enter a search term
  2. Click “New step”

  1. Choose “Add an action”

  1. Choose “Slack – Post Message”

  1. Enter a channel name
  2. Click here (or click “Add dynamic content”) to open the panel on the right
  3. Click TweetText

The Logic App should look like this in the designer depending on your settings (I choose to look for “#azure” at Twitter and I drop them in a channel at Slack called “#sdn”). Warning: Beware that if you look for #azure you’ll get a lot of messages! Follow the following steps:

  1. Click “Save”
  2. Click “Run”

Now, as per the settings for frequency at the Twitter trigger, this Logic App will drop the Tweets in your chosen Slack channel with the search term you specified.

Logic Apps ❤ Azure Functions

The biggest gamechanger for serverless on Azure however is the ability to use Azure Functions in Logic Apps! Let’s see how easy it is to add a step as an Azure Function in a Logic App.

First go back to the Azure Function you created and make the sure the code looks like:

#r "Newtonsoft.Json"

using System;
using System.Net;
using Newtonsoft.Json;

public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
    string jsonContent = await req.Content.ReadAsStringAsync();
    dynamic data = JsonConvert.DeserializeObject(jsonContent);


    return req.CreateResponse(HttpStatusCode.OK, new {
        greeting = $"New tweet from {data.TweetedBy}!"

Then in the Logic App choose to add a new step so you get the following screen:

  1. Choose “Azure Functions”

  1. Click request body (or “Add dynamic content”) to open the pane on the right
  2. Choose “Body”

  1. Click message text (or “Add dynamic content”) to open the pane on the right
  2. Choose “Body” (make sure it’s from the Azure Function and not from the Twitter trigger)

Now if the Azure Function step is behind the Slack – Post message step, then simply drag and drop the Slack – Post message step down so that it looks like*:

*Of course things like the name of the Azure Function and the Slack channel etc. might differ.

Now if you check in the Slack channel you see who the tweets are from.


Lots of interesting developments going on in the Azure cloud! And serverless is not a hype (like they used to think about cloud technology), but it is becoming more and more a viable option for enterprises. Want to read more of my thoughts on this subject you can check an earlier blog out here. Want to check out my slides I used at SDN Event 2017, March the 17th, about this subject you can check that out here.


About Danny

Bachelor in Commercial ICT MCTS Winforms .NET 2.0 MCTS ASP.NET 3.5 PSM I
This entry was posted in azure, serverless and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s