Suppose an application needs to resize a photo whenever someone uploads one. Keeping a server ready for that brief task may be unnecessary. With serverless computing, the cloud provider manages the server and allocates resources as the service runs, leaving you to focus on the work the application must perform. The servers have not vanished; they are simply someone else’s responsibility. section 2.2.14 section 8.0
Serverless is a spectrum, not an all-or-nothing architecture. An application can combine serverless services with services that rely more directly on servers. Pick the arrangement that fits each job. section 8.0
In Azure, serverless work can take several forms:
- Azure Functions run single-purpose units of code. Each Function lives in a Function App and starts from one trigger, such as an HTTP request, a new blob, or a queued message. section 2.2.14 section 8.6
- Logic Apps connect services in workflows. A trigger starts the workflow, and actions work with its data. section 8.6
- API Management can expose an API built from existing services and resources, including ones outside Azure. section 8.6
Give the photo one job
For an application that stores images from emails and processes uploaded photos, image resizing is a good single-purpose Azure Function. A Logic App can provide the surrounding workflow. The Function need not be responsible for the entire application. section 2.0 section 2.2.14
Hosting choice still matters. A Consumption plan charges for executions and includes a monthly free allowance; other hosting plans can offer predictable fixed monthly pricing. Serverless may save money, but the label alone is no guarantee—consider workload, performance, and cost together. section 8.3 section 8.0
Table 8.5 Comparing the main three differences between PaaS and serverless services
| Concept |
PaaS |
Serverless |
| Scaling |
You get more ways to decide how the service scales as compute requirements change, but you have to configure scaling yourself. |
Scaling is done for you and “just works.” There are some options, such as having a Premium tier Function App. |
| Time to compute |
Applications can take a while to spin up and get ready to provide the compute capacity. |
Applications are only executed when invoked, but it happens very fast. |
| Control |
You have much more control over the development environment, but that also means more configuration and maintenance. |
You have very little control over the development environment, but it’s fast to get started. |
Use the comparison to decide between serverless and platform as a service (PaaS): serverless handles scaling with less environment control, while PaaS offers more control and scaling configuration. section 8.5
Respond to an order
An Azure Function can respond to changes in Cosmos DB order data so an online store can update inventory and notify its shipping department. The illustrated Azure CLI commands create a Function App on a Consumption plan and configure deployment from a repository; they do not, by themselves, show the Cosmos DB trigger configuration. section 11.5.2








