What is Azure Functions?
Azure Functions is a serverless computing service, hosted on the Microsoft Azure public cloud, that streamlines the development of systems and applications. It differs from server-based computing in the cloud where users contract for server resources and perform their own development.
Serverless computing is also known as function as a service. The idea behind serverless computing is to eliminate infrastructure considerations for the user, letting them focus on the code itself and the events that will execute it. Azure Functions alleviates the need to provision, manage and pay for long-term compute resources in the Azure cloud.
Azure Functions competes with other serverless computing offerings, including Amazon Web Services Lambda and Google Cloud Functions.
How does Azure Functions work?
Traditional application development demands consideration of the underlying IT infrastructure. For cloud computing, an IT team must create, monitor and pay for cloud computing instances, regardless of how much work that instance does for the business.
Concern about the underlying infrastructure goes away with serverless computing. Users simply create, configure and upload code, and then define the triggers or events that will execute the code.
Triggers can come from a range of sources, including another user's application, other cloud services such as databases, and event and notification hubs. Once a trigger or event occurs, it's the cloud service provider's responsibility to load the code into a suitable execution environment, run the code and then release the compute resources.
Servers are still involved in the serverless process, but the users don't need to provision or manage compute instances. In addition, rather than pay for compute instances and other associated resources each month, users pay for serverless computing based on the amount of time a function runs in a given billing cycle.
Who uses Azure Functions?
Cloud users wanting to save time and money on their system and application development work use Azure Functions to aid their DevOps efforts. The service lets them concentrate on developing code, leaving the other development tasks to the Azure Functions tools. Time savings realized from using serverless application tools can also generate savings in cloud resource costs.
How are Azure Functions tools used?
Serverless computing functions typically aren't complete, full-featured applications. Instead, functions handle specific, short-lived tasks. Most functions involve some form of data processing, such as image or order processing, or file maintenance and data collection from internet of things (IoT) devices.
The following are examples of how an IT team uses Azure Functions:
- The Azure Event Hub delivers different event-driven functions related to conditions in the cloud environment or a user account.
- A generic web hook can process HTTP requests, which enables triggers to come from websites and GitHub repositories.
- Message traffic that arrives in an Azure Storage queue can trigger functions.
- Timers can also trigger Functions, which lets users schedule tasks, such as file cleanups, to execute on a regular basis.
Azure Functions integrates with Azure software as a service (SaaS) offerings, including Azure Cosmos DB, Azure Mobile Apps and Azure Service Bus.
Developing code for Azure Functions
Developers can code Azure Functions directly within the Azure portal, but they can also manage continuous integration and deploy pieces of code through GitHub, Microsoft Visual Studio Team Services and other development tools, such as Eclipse, IntelliJ IDEA and Xcode.
Security is required to ensure that only valid requests from authorized users and triggers will drive functions. Azure Functions secures outside HTTP triggers with OAuth systems, such as Azure Active Directory and Microsoft Account credentials.
Azure Functions pricing, limits and requirements
Three pricing plans are available for Azure Functions: Consumption, Azure App Service and Azure Functions Premium. In the Consumption plan, users pay for the time that each function actually runs. The Azure App Service plan is for users that already use App Service to run mobile, API-based and web applications. These users can run Azure Functions at no added cost. The Azure Functions Premium plan has the same features as the Consumption plan, with VNET access, enhanced performance, and no cold start and no execution charge. Free versions of Azure Functions and App Service are also available.
Azure Functions has a maximum size of 1 gigabyte for deployment packages. The default execution time limit for the consumption-based pricing plan is five minutes, although users can increase this to 10 minutes. In the Premium and App Service plans, the minimum execution time is 30 minutes, and the maximum is unlimited.
Azure Functions creates a storage account for each app that must support Azure Blob Storage, Queue and Table storage services. Azure Functions uses Azure Storage to manage triggers and log function execution. The storage demands for Azure Functions may present an added cost to users.
Strengths and limitations of Azure Functions
Serverless computing as implemented in Azure Functions provides several advantages, including the following:
- Orchestration. It's an efficient platform that helps address orchestration issues for complex projects.
- Management and scalability. No infrastructure management is required, and the service has flexible scaling.
- Development capabilities. End-to-end development tools are available for all stages of the development cycle.
- Language support. Numerous programming languages are supported, and hosting alternatives are available.
On the downside, vendor lock-in is perhaps the biggest concern, as code developed in an Azure function may have difficulty running in non-Azure environments.
Learn about four best practices to avoid cloud vendor lock-in.