A developer needs to create a serverless API that executes code in response to HTTP requests without managing any server infrastructure. Which Azure service is BEST suited?
Azure Functions on the Consumption plan is serverless: HTTP-triggered functions scale automatically on demand, and you pay only for execution time and resources used. The platform manages all infrastructure including the runtime host, and there is no server to provision, patch, or scale manually. This makes it the best fit for event-driven code triggered by an HTTP request.
Why this answer
Azure Functions is the correct choice because it is a serverless compute service that allows you to run event-driven code without provisioning or managing infrastructure. It natively supports HTTP triggers, enabling the creation of RESTful APIs that execute code in response to HTTP requests, and scales automatically based on demand.
Exam trap
The trap here is that candidates often confuse Azure App Service (PaaS) with serverless, but App Service still requires managing an app service plan and does not provide the same granular, event-driven scaling and pay-per-execution model as Azure Functions.
How to eliminate wrong answers
Option A is wrong because Azure App Service is a Platform-as-a-Service (PaaS) for hosting web applications, APIs, and mobile backends, but it requires you to manage the app service plan (e.g., scaling, instance size) and is not fully serverless; it does not execute code in a true serverless, event-driven manner like Azure Functions. Option C is wrong because Azure Kubernetes Service (AKS) is a container orchestration service that requires managing a Kubernetes cluster, nodes, and infrastructure, which contradicts the requirement of not managing any server infrastructure. Option D is wrong because Azure Virtual Machines (VMs) are Infrastructure-as-a-Service (IaaS) that require full management of the operating system, updates, and scaling, making it the opposite of serverless.