Creating a function in Azure

Functions in a serverless architecture consist of logic that serves a single, well-defined purpose. They are executed using an ephemeral compute service and can be scaled automatically based on demand. Azure Functions is Microsoft’s solution for serverless functions.

In my book, Software Architect’s Handbook, I discuss serverless architecture and the use of functions. In this blog post, we will create a function in Azure. Functions in Azure provide you with a choice of programming language (C#, JavaScript, Java, F#, with others coming in the future) and allow you to bring in dependencies from the NuGet and npm package managers. The runtime that powers Azure Functions can be found on GitHub.

There are different ways that a function for Azure can be created, such as using Visual Studio, Visual Studio Code, or the Azure command line interface (Azure CLI). However, so as to make this demo not require the installation of any tools, we will create a function through the Azure portal.

The following steps will be necessary to create a function in the Azure portal:

  • Logging in to the Azure portal
  • Creating a function app
  • Creating a function in the new function app
  • Testing the function
  • Customizing the function
  • Cleaning up resources

Logging in to the Azure portal

If you do not already have one, the first step is to create a free Azure account by navigating to Each account receives some free credit to allow you to try out Azure services.

Once you have an account, you can log in to the Azure portal by going to

Creating a function app

A function app in Azure is a container that hosts the execution of individual functions. Before we create a function, we must create a function app that will host it.

  1. In the top left corner, select the Create a resource option, followed by Compute.
  2. Select Function App.
  3. Create a function app by providing values for the various settings:
    • App Name: A unique name for the function app
    • Subscription: The subscription under which the function app will be created
    • Resource Group: A resource group is a container that holds resources related to the Azure solution. Create a new resource group or use an existing one for the function
    • Hosting Plan: The hosting plan for the function app; The consumption plan is charged on a pay-per-execution basis and dynamically allows resources based on the app’s load. The App Service Plan lets you define a capacity allocation with predictable costs and scale.
    • Location: The region where your function app will execute; Select one near you or near other services that your function will need to access.
    • Storage: An Azure storage account is used to store and access your Azure Storage data objects. Create a new storage account or select an existing one to be used by the function

  4. Click the Create button to deploy the new function app. Once the application has been deployed, you will receive a notification.

Creating a function

Once your new function app has been created, we can create a function to be used in the container. We’ll be creating an HTTP triggered function that can be executed via an HTTP call.

  1. If Function Apps is already under your Favorites, simply select it.
  2. If it isn’t already in your favorites, select All services. Find Function Apps and click the star next to it to make it one of your favorites. After doing so, select Function Apps.
  3. You should see the function app that you created previously. Click the Create New icon next to Functions under your function app in order to create a new function.
  4. To create a new function, we can either select a premade one or create one on our own. In this case, we will use one of the premade ones.
  5. Select Webhook + API and select one of the languages. In this example, I have elected to use C#. Click the Create this function button when you are finished, which will create the function.If C# was selected as the language, the code for the premade function is as follows:

Testing the function

Now that the function has been created, we can test it to confirm that it works properly.

  1. Your function has now been created and should be visible in the Functions section underneath your function app.
  2. With your function selected, click the Get function URL link to get the URL for your function.
  3. The previous step will cause the Get function URL dialog box to be displayed. Select default (Function key) for the Key drop-down, and then click Copy to copy the URL. The URL contains a key that is required, by default, to access the function over HTTP.
  4. Paste the URL into a browser. As we saw when looking at the code, there is a query string parameter for a name Add &name=<yourname> to the end of the URL, replacing <yourname> with your actual name. Press the Enter key to execute the request.

If the name that you passed was “Joe,” depending on the browser that you used you would either see the string “Hello Joe” or you would see it in XML format.

Trace information is written to logs during function execution. With the focus being placed on your function in the Azure portal, the contents of the logs can be viewed at the bottom of the page.

Customizing the function

You may want to customize the function that you just created in terms of things like the HTTP methods that are supported by the function and the routing template. Under your specific function, select the Integrate option.

There are various options for the HTTP trigger that can be customized.

Allowed HTTP methods

You can configure your function to support all HTTP methods (in which case the Selected HTTP methods section with its checkboxes is hidden) or selected HTTP methods. In the Selected HTTP methods section, you can choose which HTTP methods you want the function to support (GET, POST, DELETE, HEAD, PATCH, PUT, OPTIONS, and TRACE).

Authorization level

You can choose between the following authorization levels:

  • Function
  • Admin
  • Anonymous

With Function selected as the authorization level, an API key is required to access the function. This key was being passed as part of the URL:

If we set the authorization level to Anonymous, our function will be accessible without an API key. This makes the URL look as follows:

Route template

You can change the route that is used in order to invoke the function.  For example, if you were to enter “/HelloTrigger” in the Route template textbox, instead of using the function name in the URL as is the case by default, the enter route template value will be used instead. The resulting URL is as follows:

The “api” part of the URL is part of the base path prefix and is handled by a global setting.

Cleaning up resources

Resource groups in Azure are containers that hold resources such as function apps, functions, and storage accounts. Deleting a resource group deletes everything that it contains. Once you are done with the demo, you may want to delete the resource group that was used so you are not billed for any resources.

  1. In the Azure portal, go to the relevant resource group page. One of the ways that this can be done is by selecting Resource groups and then selecting a resource group.
  2. An alternative approach is to select our function app as we had done previously and select its resource group from there.
  3. With the resource group in focus, select the Delete resource group
  4. Follow the instructions and click the Delete


It can take a few minutes, but eventually, the resource group and its contents will be deleted. A notification will appear to let you know when it is done.

Joseph Ingeno is a software architect who has designed and developed many different software applications. During his career, he has worked on projects for a number of different business domains, using a variety of technologies, programming languages, and frameworks. His book, Software Architect’s Handbook, was published by Packt and is now available.


Understanding Microsoft’s Support Policies for .NET Core

Microsoft’s support for .NET Core 2.0 will end on October 1, 2018. Why? To answer that question, let us explore Microsoft’s .NET Core support policy. Each release of .NET Core is designated as either a Current release or a Long Term Support (LTS) release.

Current Releases

A Current release is one that includes new features but may change based on further testing and feedback from the user community. A Current release is supported for three months after a subsequent Current or LTS release. While you get access to the latest features, you will need to upgrade to newer versions of .NET Core to qualify for support.

Patches are released for a Current version, as needed, to fix any critical issues or to add support for new operating system versions. You must apply the latest patches to continue to qualify for support.

Long Term Support (LTS) Releases

A Long Term Support (LTS) release is more stable and is provides a longer period of support. A LTS release is supported for three years after its initial release or one year after a subsequent LTS release, whichever is longer.

Like a Current release, patches are provided for critical issues when they are needed and you must apply them to qualify for support.

.NET Core Releases

.NET Core 2.0 is a Current release and because .NET Core 2.1 was originally released on May 30, 2018, we should expect that support for .NET Core 2.0 would end on September 1, 2018. However, that support was extended by a month, to October 1, 2018, because a bug was found that prevented a limited number of users from upgrading to .NET Core 2.1. That bug has since been fixed and the official release date of .NET Core 2.1 (LTS) took place on September 11, 2018.

As of this writing, the following table shows the .NET Core releases and their expected end of support dates.

Version Release Date Support Level End of Support Date
1.0 June 27, 2016 LTS June 27, 2019
1.1 November 16, 2016 LTS June 27, 2019
2.0 August 14, 2017 Current October 1, 2018
2.1 September 11, 2018 LTS At least 3 years from LTS designation (which was August 21, 2018)

Joseph Ingeno is a software architect who has designed and developed many different software applications. During his career, he has worked on projects for a number of different business domains, using a variety of technologies, programming languages, and frameworks. His book, Software Architect’s Handbook, was published by Packt and is now available.


GitHub Continues to Grow in 2017

GitHub has been around nearly 10 years, and they recently completed their annual look at the State of the Octoverse. Use of GitHub has grown to 24 million developers across 200 countries. 6.7 million new developers joined GitHub in the last year.

GitHub is now comprised of over 67 million repositories, 25.3 million of which saw at least some public activity within the last year. There have been 1.3 million new pull requests over the last year, including the very first one by Linus Torvalds.

Use of GitHub Enterprise is growing as well, with 52% of Fortune 50 and 45% of Fortune 100 companies now using it.

Here are the 15 most popular programming languages on GitHub, based on the total number of pull requests:

15 Most Popular GitHub Languages
[Original from The State of the Octoverse 2017]
Unsurprisingly, JavaScript continues to be the most popular, but Python replaced Java this year as the second most popular language. The popularity of TypeScript continues to grow, as it had almost four times as many pull requests as compared with the previous year.

In 2017, the 100,000,000th pull request was merged, and over 68 million issues were closed!

Here are the 10 most-forked projects and the 10 projects with the most contributors:

10 Most Forked GitHub Languages
[Original from The State of the Octoverse 2017]
10 Projects with the Most Contributors
[Original from The State of the Octoverse 2017]
It was another year of tremendous growth for GitHub. I look forward to what the next year will bring to the Octoverse.


.NET Conf 2017 Videos

This year’s .NET Conf, a free virtual conference for everyone interested in .NET development, recently took place. The three day event was live streamed on Microsoft’s Channel 9 website, and was co-organized by the .NET community and Microsoft.

There were sessions on a variety of topics, such as .NET, ASP.NET, Visual Studio, Entity Framework, WinForms/WPF/UWP, Xamarin, C#, and others. Videos of the sessions have been made available for you to watch, and the following is a full list of them, along with their links.

.NET Conf Day 1 Keynote: Scott Hunter
What’s New in Visual Studio 2017
What’s New in ASP.NET Core 2.0
What’s new in Xamarin
.NET Standard 2.0
.NET Core Microservices on Service Fabric
Diagnostics 101
Beyond Mobile: Server, Games, and more with Visual Studio for Mac
Bringing your WinForms/WPF investments forwards with UWP/.NET Standard 2.0
Build Your Own Cortana Skill
Containerized ASP.NET Core Apps with Kubernetes
What’s New in Entity Framework Core 2.0
Build, Test, Distribute, and Monitor Xamarin apps with Visual Studio Mobile
How to build a massively, scalable globally distributed app in minutes with Azure Cosmos DB
Deployment Techniques and Linux Containers with .NET Core 2.0
Introduction to IoT
Full Stack F# with Fable
Xamarin with Azure IoT Hub
Turning software into computer chips – Hastlayer
Azure App Service: The Best Place to Host your .NET Apps
Running PHP on .NET Core with Peachpie
Go Serverless with Azure Functions and C#
From Start-Up to a Million Monthly Users – Sports Analytics in .NET at Bleacher Report
Database DevOps for .NET Developers with SSDT and SQL Server 2017
Getting Started with .NET Part 1
Getting Started with .NET Part 2
C# Part 1 – Introduction to C#
C# Part 2 – What’s New in C#
Building Web APIs with ASP.NET Core 2.0
Building your CI/CD pipeline for ASP.NET and Mobile using Visual Studio Team Services
Solid Design Patterns for Mere Mortals
ASP.NET Core 2.0 Security
Xamarin Forms 3.0
The C# async await Workout
Intro to Xamarin Forms
Get started with F# and .NET Core
Responsive UI with Xamarin
Introducing Razor Pages
Get Started with ASP.NET Core 2.0
Microsoft Graph for the .NET Developer
DevOps with ASP.NET Core, EF Core, & TFS 2017
Supercharge your Debugging in Visual Studio
Developing ASP.NET Core MVC Apps for International Users
Windows Mixed Reality at 90 FPS
Xamarin Forms TV App Development for Tizen

Even though this year’s .NET Conf is over, a variety of .NET Conf local events around the world are taking place between now and the end of October. Check out the full list of events and attend one in person!


Publishing New npm Packages Now Require Email Verification

Starting on Tuesday, July 25th, 2017, you will be required to verify your email address in order to publish new packages. This change applies to new packages only – You will not need to verify your email address to publish new versions of existing packages.

With the popularity and growth of npm, it has increasingly become a target for spammers. Spammers publish many packages, sometimes thousands at once, to the registry. Without a verification step, spammers can create new accounts and begin spamming very quickly.

In order to combat this, npm has decided to require email address verification to publish new packages. This is just one of several steps that npm is taking to prevent spam. Npm is also working with Smyte to use package metadata and README data to try to identify spam packages so that they can be removed as quickly as possible.

After logging into the npm website, if your email address needs verification you will now get a message like this one:

npm Email Verification
Click the “Do you need us to send it again?” link to have a verification email sent to you. The process is quick, and requiring it will slow down spammers and help keep the registry clean.