Tag: Azure Functions


Azure Functions Visual Studio Tools Preview for VS’2015

functions_colorThe serverless computing realm of cloud computing has been growing in interest and functionality lately. Recently, Azure Functions reached General Availability and an eagerly anticipated v1.0 release. Microsoft has not stopped there, in fact they just recently released a Preview of the new Visual Studio Tools for Azure Functions. These tools bring Azure Functions support into the Visual Studio IDE!

Visual Studio Tools for Azure Functions Preview

The new Visual Studio Tools for Azure Functions is currently in a Preview release state. As a result, the tools aren’t fully complete yet, and as with any Preview release it can be expected that things may / will change a bit before the final release. All preview releases can be expected to have some rough spots, bugs, and limitations. That being stated…

The requirements to install the Visual Studio Tools for Azure Functions are:

  • You must be running Visual Studio 2015 Update 3 with the “Microsoft Web Developer Tools” extension installed.
  • You must have Azure 2.9.6 .NET SDK installed.

Once you have the following prerequisites installed, you can go ahead to download and install the Visual Studio Tools for Azure Functions Preview.vsazurefunctionstoolspreviewinstaller01

Create New Azure Functions Project

Once the Visual Studio Tools for Azure Functions Preview is installed, you can easily create a new Azure Functions project within Visual Studio 2015 from the New Project dialog. It is located under the Cloud section under Visual C#.


Even though the Azure Function (Preview) project template is located underneath the Visual C# -> Cloud section, you are able to create / author Azure Functions in non-C# languages within the project after creation.

vsazurefunctionspreview_addfunctionmenuTo add a New Azure Function to the project, just following these steps:

  1. Right-click on the Project within the Solution Explorer window.
  2. Click on Add, then New Azure Function…
  3. Within the New Azure Function dialog, select the Azure Function template in your choice language from the list.

The list of languages supported for authoring Azure Functions within the Visual Studio Tools for Azure Functions is inclusive of all the languages supported by Azure Functions. This makes the tool much more flexible than if it were to only support C# and JavaScript as the current editor UI does within the Azure Portal.

vsazurefunctionspreview_addfunctionlanguagedropdownThe Azure Functions languages supported include:

  • Bash
  • Batch
  • C#
  • F#
  • JavaScript
  • PHP
  • PowerShell
  • Python

In addition to choosing the language template for the Azure Function to add to the project, there are also many different templates to choose from including different types of Triggers that will be setup for the Azure Function. Not all the languages support all the different Trigger types and Function templates from the New Azure Functions dialog, but there is a fairly long list currently available; especially for C# and Javascript.


Here’s a list of the different types of Azure Functions currently available within the Preview release. Remember, the options do vary depending on the programming language selected.

  • Empty
  • BlobTrigger
  • HttpTrigger
  • QueueTrigger
  • EventHubTrigger
  • FaceLocator
  • Generic WebHook
  • GitHub Commenter
  • GitHub WebHook
  • Http GET (CRUD)
  • Http POST (CRUD)
  • Http PUT (CRUD)
  • Image Resizer
  • ManualTrigger
  • SAS Token Generator
  • ServiceBusQueueTrigger
  • ServiceBusTopicTrigger
  • TimerTrigger

Once you choose the Azure Functions template to start from for a new Function, there are some Bindings fields that need to be filled in. These Bindings fields will vary depending on the Azure Functions template chosen to create a new Function from.

Azure Functions Project Files

vsazurefunctionspreview_solutionexplorerThe layout of the files created for a new Azure Functions project is similar to how the files of an Azure Function created through the Azure Portal are laid out.

At the root of the project are the appsettings.json and host.json files. These are files that can be used to describe some things for the projects, but at initial creation they are pretty much empty.

The appsettings.json file can be used to configure any necessary App Settings values that are needed by the Azure Functions within the project.

Then there is a folder created for each Function that gets created within the Azure Function. in this screenshot is an example of a new Azure Function that was created using the Manual Trigger C# template.

The functions.json file contains configuration data for the Function. This is the JSON file that is used to specify / configure the Function Bindings for Inputs and Outputs of the Function.

[code language=”js”]

“bindings”: [
“type”: “httpTrigger”,
“direction”: “in”,
“route”: “orders”,
“authLevel”: “anonymous”
“type”: “http”,
“direction”: “out”


The project.json for a C# Azure Function is where any NuGet dependencies for the Function get defined. It’s useful to know that in addition to using the project.json file, Azure Functions to automatically have access to some standard namespace imports that just be referenced with a using keyword. There is also a shorthand syntax for adding references to external assemblies from within the C# script file.

Here’s a sample of a project.json file that adds a NuGet reference:

[code language=”js”]

“frameworks”: {
“dependencies”: {
“Microsoft.ProjectOxford.Face”: “1.1.0”


Local Debugging

Azure Functions projects can be run on the local development machine. Currently, in the Visual Studio Tools for Azure Functions Preview release only supports remote debugging with C#, but that is expected to be expanded out in the future.


One prerequisite for running and debugging Azure Functions locally is that the Azure Functions CLI needs to be installed. The first time an Azure Functions project is run locally, it will prompt to download and install the Azure Functions CLI, so this is an easy requirement to manage / obtain.


Publishing to Azure

Azure Functions project can be published to Azure In the same manner as publishing Web Apps into an Azure Subscription. An Azure Web App is created within an Azure Subscription, then the credentials and other information for the Web App is configured within the Publish dialog for the project. Then the Azure Functions project can easily be published into Azure directly from within Visual Studio.

In line with other functionality of Azure Web Apps, the Azure Functions project can also be Debugged Remotely from the local development machine while running in Azure. Currently, this is only supported with C# based Azure Functions.


Known Limitations

The Visual Studio Tools for Azure Functions Preview announcement post lists a few known limitations for this new Preview release. The are as follows:

  • IntelliSense support is limited, and available only for C# and JavaScript by default. F#, Python and PowerShell IntelliSense support is available with the installation of additional components.
  • Adding New files is not available using “Add New Item”.
  • There is currently a bug that causes Functions published from Visual Studio to be improperly registered in Azure.
  • The C# Image Resizer function template incorrectly generates the function Bindings. These need to be manually edited to fix.

Product Feedback

The Azure Functions team is eager to get feedback from anyone using the new Visual Studio Tools for Azure Functions Preview release. Any issues can be reported using the GitHub repository (please include “Visual Studio” in the issue title), plus additional comments and questions are welcome on their Twitter accounts as well.


What is Serverless Architecture?

One of the latest moves by cloud service providers (like Microsoft Azure and Amazon AWS) is the shift to offering “serverless” services. These are Platform as a Service (PaaS) services that take the “fully managed” aspects of the service to the max. Serverless service offerings (such as Microsoft Azure Functions) allow for individual code functions to be deployed and managed without the need to deploy and manage the underlying Virtual Machine (VM), including even the applications that hosts the functions too! Additionally, the billing of Serverless architecture only charges you when your code is running, instead of paying to keep the underlying server resources reserved and available. This article will dig into Serverless Architecture,  and help clear up many of the common questions surrounding this “Platform as a Service to the MAX” technology.

Serverless Architecture

Serverless architecture isn’t really to host applications without servers. Of course there still needs to be CPU, RAM, Networking and other components of a computer server in order to host any software. Rather, Serverless really is about taking Platform as a Service (PaaS) to the max!

Serverless is about taking PaaS and turning it up to 11!

Modularity & Flexibility

Platform as a Service (PaaS) abstracts away the underlying hardware and infrastructure so that application code can more easily be hosted, deployed, and managed with much less overhead than traditional hosting. Serverless architecture takes PaaS to the most extreme, by fully abstracting away the server in such a way that a single function of code can be hosted, deployed, run, and managed without even having to maintain a full application.

Each function of code for a back-end systems Web API or Background Processes can be managed individually with Serverless architecture. This helps make systems much more modular, as well as increasing the overall system flexibility. This enabled modularity is ideal for Micro-Services based systems as well.

With the modularity of hosting individual Functions of code comes with it added flexibility. Not flexibility in the Function, but rather flexibility in writing, maintaining, and deploying code. Each Function can be maintained, updated, and deployed individually. This mean that each Function can be updated and deployed in isolation without the risk of taking down other Functions in order to do so.

Functions in Serverless architecture can almost be thought of as “mini-programs” that are maintained by themselves.

Event Driven

Just as a Function of code within an application, in Serverless architecture there needs to be something to trigger the code to run and subsequently return a result. The entry points to execute Functions of code hosted in a Serverless architecture are built around events. This Event Driven (or Event-based) design of Serverless architecture is ideal since Functions of code are hosted as individual items.

Functions of code hosted in Serverless architecture are bound to specific events that fire them off and execute them when necessary. Here’s a few examples of events that can be used to trigger the execution of Functions of code in Serverless architecture:

  • HTTP / HTTPS Request
  • Message Queue Trigger
  • File / Storage Trigger
  • Timer / Schedule

An HTTP / HTTPS Request trigger can be used to expose a Function of code as a Web Service / API of some kind. For example, it could be used to expose a REST API endpoint that performs an action and returns a JSON response. This type of usage would allow for a Serverless implementation of a Web API without the need to build a larger application / infrastructure to host it.


Functions of code hosted in Serverless architecture are bound to specific events that fire them off and execute them when necessary.


The possibilities of pricing Serverless architecture differently is possible due to it being based around an Event Driven model. Other more traditional Platform as a Service (PaaS) allow for reductions in hosting and ownership costs by abstracting away many manual tasks necessary for general server maintenance and deployment. In a way traditional PaaS is “serverless”, but not completely.

Full Serverless architecture hosting services allow for an even greater abstraction of the underlying hardware, Virtual Machine (VM), and infrastructure than traditional PaaS offerings. Since these things are abstracted away as much as possible with Serverless architecture, it enables the Functions of code to be hosted in a way that can better utilize the underlying CPU/RAM hardware with multi-tenancy. Due to this, the cost of Serverless services provide even greater cost savings over traditional PaaS services.

Multiple clients Functions of code can be hosted on the same hardware and/or Virtual Machine (VM) with the ability to host Serverless architecture services in a multi-tenant manner. This allows Cloud Service Providers, like Microsoft Azure, to even further utilize their CPU/RAM and other server hardware to their capacity. This is done by pooling Functions of code / applications from multiple clients (tenants) on the same hardware.

Since Serverless architecture is best hosted in a multi-tenant manner (as described above) the majority of service providers bill Serverless services out on a “Pay-per-Use” basis. Without a full VM, CPU/RAM allocation being billed and paid for to be reserved / available, it doesn’t make sense to bill clients for a full VM instance. Instead, Serverless cloud services (like Azure Functions) are billed by keeping track of the total CPU and other resources used solely during Function code Execution.

Pay-per-Use serverless architecture billing is simplified that charges are only incurred if and when the Functions code is actually executing. When an event triggers the Function to execute, the resources consumed by the Function of code are tracked and billed. When the Function of code is NOT executing, then no costs are incurred.

The billing of Serverless architecture only charges you when your code is running, instead of paying to keep the underlying server resources reserved and available.


With the multi-tenant nature of Serverless architecture, it’s possible for the underlying platform to host and run each Function of code for a particular client on completely disparate hardware and Virtual Machines (VMs) completely unbeknownsed to the client. This method of hosting makes if ideal for automatic scalability.

Serverless architecture services are able to utilize their “Platform as a Service (PaaS) to the MAX” nature to better optimize scalability than traditional PaaS services. In addition to potentially hosting each Function of code on different underlying servers, there could also be multiple instances of each Function of code hosted across multiple underlying servers as well. This allows a Serverless platform (like Azure Functions) to automatically scale out to the maximum degree.

Serverless architecture services are able to utilize their “Platform as a Service (PaaS) to the MAX” nature to better optimize scalability than traditional PaaS services.

Serverless in Microsoft Azure

The service offering in the Microsoft Azure cloud platform is the Azure Functions service. Azure Functions allow for Serverless architecture to be built out on the Microsoft Azure platform. It also supports many different platforms and frameworks, like .NET, Java, Python, and Node.js. Azure Functions are extremely flexible where Functions can easily be authored in .NET or Node.js directly within a web browser. Azure Functions can even be built as a console applications or entirely as shell scripts.

The next wave of Platform as a Service (PaaS) is here, and it’s Serverless Architecture!



How Azure Functions Pricing Works

Serverless computing is a growing trend in cloud computing, and it’s a natural next step in the Platform as a Service (PaaS) area. First PaaS allowed applications to be hosted without requiring Virtual Machines to manage, then serverless computing further removes the construct of a server. Azure Functions is the service within the Microsoft Azure cloud that offers serverless hosting and execution of application code. With serverless architecture removing the construct of a server from the equation of application hosting the concept of pricing begins to get a little fuzzy. This articles explains how Azure Functions pricing works.

Azure Functions is available with the 2 following pricing methods:

Consumption Plan

functions_colorWith Consumption Plan hosting, Azure Functions completely abstracts away the server construct. You no longer pay for reserving CPU Cores and RAM of the underlying Virtual Machine (VM). You only pay for the time your code runs, and not for the time it remains idle.

When provisioning Azure Functions in Microsoft Azure, the Hosting Plan option of Consumption Plan will configure the use of the Consumption Plan. Rather than specifying the CPU Cores and RAM of the underlying VM, the Consumption Plan specifies the Memory Allocation to reserve for the Azure Functions service while it is running.

The options for Memory Allocation range from 128 MB on the bottom all the way up to a maximum of 1.5 GB of memory.

You only pay when the Azure Function is run.

When Azure Functions execute the scalability of the application code is handled automatically behind the scenes by the service without the need to configure any Autoscaling or even manually scaling the App Service Instance like would be needed if the same code were hosted in an Azure App Service WebJob.

Further details on the specifics of Azure Functions pricing can be found on the official Azure Functions pricing page.

App Service Plan

appservice_colorWith App Service Plan hosting, Azure Functions runs on top of an Azure App Service Plan. With this method the Platform as a Service (PaaS) Virtual Machine (VM) under the covers remains reserved. The CPU Cores and RAM of the VM still need to be specified as they are reserved for the instance size the same as with any other Azure App Service; such as Azure Web Apps or API Apps.

When provisioning Azure Functions in Microsoft Azure, the Hosting Plan option of App Service Plan will configure the use of an App Service Plan for hosting the Azure Functions. The underlying Virtual Machine (VM) will be reserved just like any other Azure App Service Plan service (Web Apps, API Apps, and Mobile Apps).

Azure Functions can run in an App Service Plan of another resource without incurring additional compute costs.

The App Service Plan hosting plan option for Azure Functions exists for the purpose of hosting Azure Functions along-side other App Service resources running in an App Service Plan. While it may not be practical to host Azure Functions in a VM Instance in an App Service Plan if that’s the only resource being hosted, since it would cost much more than if Consumption Plan were used instead.

By using App Service Plan hosting plan, the Azure Functions can run within an App Service VM Instance, thus allowing for even further cost savings by utilizing over provisioned resources of an existing App Service Plan VM Instance. In other words, if the Azure Web App being hosted doesn’t exactly need all the CPU Cores and RAM allocated to it, then hosting Azure Functions here will utilize what’s already being paid for without incurring additional computer costs.

Further details on the specifics of Azure App Service pricing can be found on the official Azure App Service pricing page.

Internet of Things

MkeAzure Slides: Getting Started with IoT using Azure, Windows IoT and Raspberry Pi

On Aug 17, 2016 I gave a “Getting Started with IoT” talk at the Milwaukee Azure group. In my talk I covered the basics of IoT Messaging Architecture and Azure IoT Suite (specifically IoT Hub and Stream Analytics), along with other Azure services such as Service Bus Queus, DocumentDB, and Azure Functions. No, IoT solution is complete with out an actual hardware device, so I showed what’s necessary to get started with Windows IoT development on a Raspberry Pi 2/3 along with an Adafruit BME280 Temp/Humidity/Pressure sensor and an LED wired up to the device. Read More