Introduction to Azure Functions

What are Azure Functions?

Azure Functions is a serverless, cross-platform and open source solution that enables a developer to implement functionality with minimal code on managed infrastructure.

Azure Functions scales dynamically and supports several programming languages such as .NET, Java, Javascript, Python, etc.

Azure Functions should be triggered to execute and can be connected to different sources and targets through bindings.

To host a Function in Azure, a function app is required which will logically group together functions for easier management, deployment, scaling and sharing of resources.

Various hosting plans are available to host a function app:

PlanAdvantagesDisadvantages
Consumption Plan1. Pay only when your functions are executed.

2. Dynamically scale for usage and demand.
1. Cold starts – a brief delay when the function starts executing.
Premium Plan1. Perpetually warm instances.

2. VNet connectivity

3. Unlimited execution duration.

4. Premium instance sizes.
1. Price
Dedicated Plan1. Dedicated VMs

2. Reuse your existing app services.

1. Not serverless

Anatomy of a Function App

Core Files

  • host.json

The host.json file contains global configuration options and will impact all functions within the function app.

{
     "version": "2.0",
     "logging": {
         "applicationInsights": {
              "samplingExcludedTypes": "Request",
              "samplingSettings": {
                   "isEnabled": true
              }
         }
     }
}
  • function.json

The function.json file contains the configuration metadata such as related triggers and bindings for an individual function.

To learn more about the JSON schema for Azure Functions function.json files, check out http://json.schemastore.org/function.

  • local.settings.json

The local.settings.json file contains local configuration settings for your application. Local configuration settings are ignored by Git and Azure. If you’re developing a function app with .Net Core, you can use the IConfiguration infrastructure to easily read environment variables, user secrets and other configuration providers in addition to the local.settings.json file.

{
    "Values": {
        "AzureWebJobsStorage": UseDevelopmentStorage-true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet"
    }
}

Language and runtime support

Azure Functions can run on both Linux or Windows depending the runtime stack you choose when creating your Function.

LanguageRuntime StackLinuxWindowsPortal editing
C# class library.NET✔️✔️
C#.NET✔️✔️✔️
JavascriptNode.js✔️✔️✔️
PythonPython✔️
JavaJava✔️✔️
PowershellPowershell Core✔️✔️✔️
TypeScriptNode.js✔️✔️
Go/Rust/OtherCustom Handlers✔️✔️

Leave a Reply

Your email address will not be published. Required fields are marked *