Introduction
Azure Function is the centerpiece of the Azure Serverless platform. It is basically a compute which react to timers or HTTP or events from Azure services like Event Hubs. Azure Function allows you to define your code in various programming languages like Python, C#, F#, Java and more. So, Azure Function basically allows you to execute your code based on the events you specify.
Azure Functions 1.0 challenges
- Need for additional language support, e.g. Java, Python, PowerShell
- Only able to host on Windows
- No support for development on Mac and Linux
- Assembly probing and binding issues for .NET developers
- Performance issues on a range of scenarios/languages
- Lack of UX guidance to production success
What’s new in Azure Functions 2.0?
- New Functions quick start by selected programming language
- Updated runtime built on .NET Core 2.1 (supported .NET Framework on the previous version)
- Deployment: Run code from a package
- .Net Function loading changes
- Tooling Update: Visual Studio, CLI and VS Code
- Consumption-based SLA
Key differences between Azure Functions 1.0 and 2.0
Some of the highlighted differences between both the versions of Azure Functions are highlighted in the picture,

Bindings and Integration
Previously in Azure Functions 1.0, there were a lot of native bindings available, so the runtime had to be changed in order to make changes to them (Bindings), but in Azure Functions 2.0, the runtime will be developed separately (Version independent) to get more clarity on the extensibility model.

What is hard with Azure Functions?
- Manageable Sequencing + Error Handling
- Fanning-out and Fanning-in
- External Events Correlation
- Flexible Automated Long-running Process Monitoring
- Http-based Async Long-running APIs
- Human Interaction
Furthermore, Azure Functions Monitoring is also becoming hard when involving complex serverless solutions.
However, there are a couple of workarounds to ease out the monitoring case.
.NET Assembly probing and binding improvement
- Runtime assemblies isolation – This involves leveraging new capabilities introduced in the .NET core to provide better isolation between runtime dependencies and the dependencies which users bring in as part of the function using assembly load context. This makes sure the probing and the binding works as expected followed by automatic unification (implicit binding redirects).
- Improved probing/resolution behavior – The enhanced probing behavior brings in the following capabilities for the users,
- Publish artifacts and deps file
- Automatic resolution of runtime/platform dependencies and native assets
- Consistent with .NET core
- Improved extensibility consolidating on new load behavior – This solves the conflicts involved while loading the dependencies as a common dynamic assembly load mechanism solves it for all the available extensions.
- Out-of-Process .NET language worker (Roadmap) – Not yet made generally available, this model involves the following capabilities,
- Serialization/Deserialization of triggers and bindings
- More flexibility around .NET versions
- Dependency injection
Language Extensibility
In the 2.0 model, the worker and the host are broken into two separate processes – host process and language process. The events and the HTTP requests will be received in the host processor through the script host which does the inter-process communication to communicate with the language process as in the below picture,

Through this model, the development of new language workers can happen independently, and the worker process crashes will not bring down the host.
Azure Functions tooling option
Azure Functions supports the following set of tools such as,
- Visual Studio
- VS Code
- CLI
- Portal
- Deployment options
The problem in the previous deployment options
Through FTP, users can put their files on production one at a time, and at that time there might be a chance where the deployment may fail in the middle of using the files. Another common scenario that the customer might face is when they want to deploy their work across multiple regions (Functions App) from a single repository where the deployed region might be running on one version and the receiving region on another version leading to deployment issue. So, the solution for this problem is brought up by a functionality where we can run the code from a zip file and that zip file can be stored in Azure storage externally to your app.
Demo - Dependency Injection
It is not easy to manage dependencies considering the static nature of Azure function triggers. This might be an issue as Dependency Injection is imperative to unit testing in C#. So, here is a scenario on handling dependency injection in Azure Functions.

The code in the above picture depicts that the run method is not static but an instance method followed by a constructor with dependency on a service which here is IMyService. An instance id will also be created (_instanceId) whenever the constructor is called. Now, when an instance of the function is created, the local variable (_myService) will be assigned with the instance of IMyService and as for _instanceId, a new Id will be assigned.






Join the conversation! Your thoughts help the community grow.