An email attachment lands in Blob Storage. A small piece of code resizes the image, saves a web-friendly copy, and stops. Azure Functions runs that kind of single-purpose, event-driven work without requiring you to manage the underlying servers. A trigger starts each function; Azure allocates compute when it runs. “Serverless” still involves servers—they’re simply someone else’s responsibility. section 2.2 section 2.2.14 section 8.6
Functions live inside a Function App, which provides their hosting and management environment. One app can hold multiple functions. Each function has exactly one trigger, such as an HTTP request, a new blob, or a queue message. Bindings connect it to other Azure resources, sparing the code some resource-handling work. section 2.2.14 section 8.6
Resize an uploaded photo
When a new image arrives in Blob Storage, a blob trigger passes it to a function. Configure a Blob Storage output binding to save the resized copy in a separate container, preserving the original. The example uses C# streams for the input and output and the ImageSharp library to resize the image to 100 × 100 pixels. That fixed size may distort it: a useful first working version, not a portrait photographer. section 2.2 section 2.2.19 section 2.2.20
Choose hosting to fit the workload, not just the word “serverless”:
- Consumption scales to zero and charges for usage, suiting sporadic work; an idle function may experience a cold start. section 8.2.3
- Premium keeps instances warm for faster starts and supports longer runs and virtual network integration, but reserved capacity costs money even when idle. section 8.2.3
- Flex Consumption offers more control over memory, scaling, and networking; Dedicated uses an App Service plan, while Container Apps supports container-based workloads. section 8.2.3
Table 8.3 Azure Function pricing for various hosting options
Compare the five hosting options by use case and charging model before selecting a plan. section 8.2.3
To get started, create a Function App with the Azure portal or Azure CLI, then create a function with a trigger. The CLI setup needs a storage account; keeping it in the same region as the app reduces travel time for data. VS Code supports local development before publishing. For an HTTP trigger, choose its authorization level deliberately: anonymous accepts requests without a key. Azure can add function instances as work increases, but scaling does not replace a sensible choice of hosting plan. section 8.2 section 2.3.1 section 8.2.3
