Microsoft Certified: Azure Developer Associate (AZ-204)Develop Azure compute solutionsEasy

A company is developing a new serverless API that will be invoked by a mobile application. The API needs to handle authentication using Azure Active Directory (AAD) and integrate seamlessly with other Azure services like Azure Cosmos DB. The development team prefers C# and wants to use an HTTP trigger for the API. Which Azure compute solution should they choose?

  1. AAzure Container Instances
  2. BAzure Functions with HTTP Trigger
  3. CAzure App Service Web App
  4. DAzure Virtual Machines with a custom web server
Show answer & explanation

Correct answer: B. Azure Functions with HTTP Trigger

Azure Functions with an HTTP trigger are ideal for serverless APIs. They natively support C#, integrate well with Azure Active Directory for authentication, and have robust bindings for other Azure services like Cosmos DB, perfectly fitting the requirements.

Why the other options are wrong

  • A. ACI can run containers but lacks the built-in serverless execution model, automatic scaling, and native integrations provided by Azure Functions for API development.
  • C. Azure App Service Web Apps can host APIs but are not inherently serverless and would incur costs even when idle, which contradicts the serverless preference.
  • D. VMs provide too much overhead and management for a serverless API, requiring manual setup of authentication and integrations.

HTTP Trigger (Azure Functions)

An Azure Function binding that allows a function to be executed in response to an HTTP request, making it suitable for building serverless APIs and webhooks.

  • Supports various HTTP methods (GET, POST, PUT, DELETE)
  • Can be secured with API keys or Azure Active Directory
  • Allows custom routing and URL paths
  • Returns HTTP responses directly

Memory trick: Functions build APIs fast, with triggers and bindings that last.

More Develop Azure compute solutions questions