Azure

Azure Functions interview questions and answers

Azure Functions questions from the basics (triggers, bindings, the isolated worker model) to what interviewers ask experienced developers: scaling, retries, Durable Functions, security and deployment. Each answer explains the reasoning, with short code where it helps.

Mixed · 20 questions · Tap a question to see the answer.

New to this? Learn it step by step in the free Azure Functions course.

  1. Q1. What is Azure Functions, and when is it a good fit?

    Azure Functions is Azure's serverless compute service: you write small pieces of code that run when something happens, such as an HTTP request, a timer, a queue message or a new blob. Azure runs and scales them for you, and on consumption-style plans you pay only while code runs.

    It suits event-driven work: background jobs, processing uploads, reacting to messages, scheduled tasks and small APIs. It is a weaker fit for long-running stateful servers or apps that need many always-on connections, where App Service or Container Apps is simpler.

    Official documentation

  2. Q2. What is the difference between a trigger and a binding?

    A trigger is what starts a function, and every function has exactly one: an HTTP request, a timer, a queue message, a blob, an Event Grid event and so on. The trigger data arrives as a parameter.

    Bindings connect a function to other services without writing client code. Input bindings read data (for example a blob) and output bindings write data (for example a queue message or a Cosmos DB document). A function can have several bindings, or none.

    Official documentation

  3. Q3. What is the difference between the in-process and isolated worker models for .NET functions?

    In the in-process model, your function code ran inside the Functions host process and had to use the same .NET version as the host. In the isolated worker model, your code runs in its own .NET process, so you choose the .NET version, control dependencies, and can use middleware and normal dependency injection.

    The isolated worker model is the one to use: Microsoft's support for the in-process model ends on 10 November 2026, and new .NET versions are supported only in the isolated model.

    var builder = FunctionsApplication.CreateBuilder(args);
    builder.ConfigureFunctionsWebApplication();
    builder.Services.AddSingleton<IOrderService, OrderService>();
    builder.Build().Run();

    Official documentation

  4. Q4. What hosting plans can a function app use, and how do they differ?

    Flex Consumption scales to zero and bills per execution and memory, with fast scaling, virtual network support and optional always-ready instances. Premium keeps pre-warmed instances so there is no cold start, and bills for those instances all the time. A Dedicated (App Service) plan runs on VMs you already pay for, with no event-based scaling beyond the plan.

    Function apps can also run in Azure Container Apps. The usual choice is Flex Consumption for most event-driven apps, Premium when you need no cold start and steady heavy load, and Dedicated when spare App Service capacity already exists.

    Official documentation

  5. Q5. What is a cold start, and how do you reduce it?

    When a plan scales to zero and a new event arrives, Azure must start an instance, load the runtime and your code before the function runs. That first slow call is a cold start.

    To reduce it: use always-ready instances on Flex Consumption or the Premium plan, keep the deployment package small, avoid heavy work in startup code, and reuse clients (HttpClient, database and Service Bus clients) instead of creating them per call.

  6. Q6. How do you run a function on a schedule, and what does the schedule expression look like?

    Use a timer trigger with an NCRONTAB expression of six fields: second, minute, hour, day, month and day of week. For example 0 30 2 * * * runs every day at 02:30.

    Times are in UTC unless you set the WEBSITE_TIME_ZONE app setting where supported. If the app was down when a run was due, myTimer.IsPastDue tells you, so the function can decide whether to catch up.

    [Function("NightlyCleanup")]
    public async Task Run([TimerTrigger("0 30 2 * * *")] TimerInfo timer)
    {
        if (timer.IsPastDue) logger.LogWarning("Running late");
        await cleanup.RunAsync();
    }

    Official documentation

  7. Q7. What are function authorization levels for HTTP triggers, and are they enough for security?

    An HTTP trigger has an authorization level: Anonymous (no key), Function (needs a function or host key in the code query string or x-functions-key header) or Admin (needs the master key).

    Keys are shared secrets, so they suit server-to-server calls and webhooks, not end users. For user-facing APIs, put Microsoft Entra ID authentication (App Service authentication) or API Management in front of the function and check the user's identity and roles.

    Official documentation

  8. Q8. What happens when a queue-triggered function keeps failing for the same message?

    For Azure Storage queues, the runtime retries the message up to maxDequeueCount times (5 by default). After that it moves the message to a poison queue named <queue>-poison, so one bad message does not block the others.

    Service Bus does the same with its dead-letter queue after the maximum delivery count. Monitor these queues and alert on them, because each message there is work that did not happen.

    Official documentation

  9. Q9. Why must queue-triggered and event-triggered functions be idempotent?

    Messaging in Azure delivers at least once: a message can be processed twice, for example after a timeout or a host restart just before the message was completed. If the function charges a card or sends an email, a second run does it again.

    Make the work safe to repeat: store a processed message or order ID and skip duplicates, use upserts instead of inserts, and pass idempotency keys to payment and email APIs.

  10. Q10. What are Durable Functions, and what problem do they solve?

    Durable Functions is an extension for writing long-running, stateful workflows in code. An orchestrator function calls activity functions in order or in parallel, and the framework saves progress so the workflow survives restarts and can wait for hours or days without running up costs.

    Typical patterns are function chaining, fan-out/fan-in (run many tasks in parallel and combine results), async HTTP APIs that return a status URL, monitoring, and human interaction such as waiting for an approval with a timeout.

    [Function(nameof(ProcessOrder))]
    public static async Task ProcessOrder([OrchestrationTrigger] TaskOrchestrationContext ctx)
    {
        var order = ctx.GetInput<Order>()!;
        await ctx.CallActivityAsync(nameof(ReserveStock), order);
        await ctx.CallActivityAsync(nameof(ChargePayment), order);
        await ctx.CallActivityAsync(nameof(SendConfirmation), order);
    }

    Official documentation

  11. Q11. Why must Durable Functions orchestrator code be deterministic?

    An orchestrator is replayed from its saved history every time it wakes up, to rebuild its state. If the code took a different path on replay, the history would no longer match and the orchestration fails.

    So inside an orchestrator, do not call DateTime.Now, Guid.NewGuid(), random numbers, HTTP or databases directly. Use ctx.CurrentUtcDateTime, ctx.NewGuid(), and put all I/O in activity functions.

  12. Q12. Where should a function app keep settings and secrets?

    Settings live in application settings, which reach code as environment variables and through IConfiguration. Locally they come from local.settings.json, which must never be committed.

    Secrets such as connection strings should not be stored as plain values: use managed identity to connect to Azure services without secrets where possible (identity-based connections), and Key Vault references (@Microsoft.KeyVault(SecretUri=...)) for anything else.

  13. Q13. How can a function connect to Storage or Service Bus without a connection string?

    Use identity-based connections: enable a managed identity on the function app, give it the right role (for example Storage Queue Data Contributor or Azure Service Bus Data Receiver), and set the connection setting to the service address instead of a connection string.

    For a connection named MyQueue, you set MyQueue__queueServiceUri (or MyQueue__fullyQualifiedNamespace for Service Bus). There is no key to leak or rotate.

    // application settings
    ServiceBusConn__fullyQualifiedNamespace = myns.servicebus.windows.net
    
    [Function("HandleOrder")]
    public void Run([ServiceBusTrigger("orders", Connection = "ServiceBusConn")] string body) { }
  14. Q14. How does Azure Functions scale, and how can you limit it?

    The platform watches the event source, such as queue length or HTTP traffic, and adds instances when work builds up. Each instance can also run several executions at once, controlled by settings such as batchSize for queues or maxConcurrentCalls for Service Bus in host.json.

    Scaling out can overload a database or a third-party API. Limit it with the maximum instance count of the app, lower per-instance concurrency in host.json, or a queue in front of the slow dependency.

  15. Q15. How do you monitor Azure Functions in production?

    Connect the function app to Application Insights. It records every execution, its duration, failures, dependencies such as SQL and HTTP calls, and your ILogger messages, so you can search logs, see the end-to-end transaction and build alerts.

    Keep sampling on for busy apps to control cost, log with structured placeholders, and alert on failure rate, poison or dead-letter queue length, and slow executions.

    Official documentation

  16. Q16. What is the function timeout, and how do you handle work that takes longer?

    Each execution has a maximum duration set by functionTimeout in host.json, with limits that depend on the plan. HTTP triggers also have a fixed limit of about 230 seconds for the response, set by the Azure load balancer, whatever the function timeout.

    For long work, return quickly and continue in the background: put a message on a queue and process it in a queue-triggered function, or use Durable Functions with the async HTTP API pattern that returns a status URL the client can poll.

  17. Q17. How do you develop and test Azure Functions locally?

    Install Azure Functions Core Tools and run func start, or press F5 in Visual Studio or VS Code. Settings come from local.settings.json, and Azurite emulates Azure Storage so queue, blob and timer triggers work offline.

    Keep business logic in normal classes registered with dependency injection, so you can unit-test it without the Functions runtime, and test the trigger wiring with a few integration tests.

    func init OrdersApp --worker-runtime dotnet-isolated
    cd OrdersApp
    func new --name GetOrder --template "HTTP trigger"
    func start

    Official documentation

  18. Q18. How do you deploy a function app safely?

    Build in CI and deploy the package with GitHub Actions or Azure Pipelines (zip deploy or run-from-package), never from a developer machine. Keep settings and the app definition in infrastructure as code, such as Bicep.

    Where the plan supports deployment slots, deploy to a staging slot, warm it up, then swap. Disable or drain queue triggers that must not run in staging, and keep the previous package so you can roll back quickly.

    Official documentation

  19. Q19. When would you choose Azure Functions over a Web API on App Service or a Container App?

    Choose Functions when work is driven by events and spiky: queues, blobs, timers, webhooks. Built-in triggers and bindings remove plumbing, and scale-to-zero keeps costs low when idle.

    Choose an ASP.NET Core API on App Service or Container Apps for a large, always-busy API with many endpoints, complex middleware or long-lived connections. Many systems use both: an API for user requests and functions for the background work behind it.

  20. Q20. How does an isolated worker function write to more than one output, for example an HTTP response and a queue?

    Return a class whose properties carry output binding attributes. The runtime sends each property to its binding, so one function can answer the HTTP call and enqueue a message.

    public class CreateOrderOutput
    {
        [QueueOutput("orders")]
        public Order? Message { get; set; }
    
        [HttpResult]
        public IActionResult Response { get; set; } = null!;
    }
    
    [Function("CreateOrder")]
    public CreateOrderOutput Run([HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req, [FromBody] Order order)
        => new() { Message = order, Response = new AcceptedResult() };

Original questions written to explain concepts; not taken from any certification exam. Spotted a mistake? See our corrections policy.