Prev Next

Java / Azure Functions Interview questions

Last updated

1. What is Azure Functions? 2. What are triggers in Azure Functions? 3. What are bindings in Azure Functions? 4. What are the hosting plans available for Azure Functions? 5. What is a function app in Azure? 6. List the commonly used triggers in Azure Functions? 7. How do you create an HTTP-triggered function? 8. What is the Timer trigger and how do you schedule it? 9. What programming languages does Azure Functions support? 10. What is the purpose of host.json in Azure Functions? 11. What is the purpose of local.settings.json? 12. What is function.json and when is it used? 13. What are the authorization levels in Azure Functions? 14. What is Azure Functions Core Tools? 15. What is the purpose of the AzureWebJobsStorage setting? 16. What are Durable Functions? 17. How do you deploy an Azure Functions app? 18. How do you monitor Azure Functions? 19. How do you store secrets securely in Azure Functions? 20. What is the billing model of the Azure Functions Consumption plan? 21. What is the difference between Consumption and Premium plans? 22. What is the Flex Consumption plan and why use it? 23. What is the difference between in-process and isolated worker models? 24. How does Azure Functions scale? 25. What is a cold start and how can you reduce it? 26. What is the difference between Azure Functions and Logic Apps? 27. What is the difference between Azure Functions and WebJobs? 28. How do you implement dependency injection in isolated.NET Azure Functions? 29. How does the Queue trigger handle poison messages? 30. How does the Service Bus trigger handle message completion and dead-lettering? 31. How does the Event Hubs trigger scale and checkpoint? 32. What is the difference between Event Grid trigger and Blob trigger for blobs? 33. How do you configure retry policies in Azure Functions? 34. How does the Timer trigger behave when the app runs on multiple instances? 35. Why must Durable Functions orchestrator code be deterministic? 36. Explain the execution flow of a Durable Functions orchestration? 37. What are the common Durable Functions application patterns? 38. Explain the fan-out/fan-in pattern in Durable Functions? 39. What are Durable entities and when would you use them? 40. How do you secure an HTTP-triggered function beyond function keys? 41. How do you use managed identity in Azure Functions? 42. How does VNet integration work with Azure Functions? 43. What are the execution timeout limits across Azure Functions plans? 44. How do you make Azure Functions idempotent? 45. How can you optimize Azure Functions performance? 46. How do you troubleshoot an Azure Function that is not triggering? 47. When should you choose Azure Functions over Container Apps or AKS? 48. How do deployment slots work in Azure Functions? 49. How do you control concurrency in Azure Functions? 50. Explain the internal working of the Azure Functions host and scale controller?

1. What is Azure Functions?

Azure Functions is Microsoft's serverless, event-driven compute service. You write a small piece of code, called a function, and Azure runs it when an event occurs, such as an HTTP request, a timer tick, or a new message in a queue.

You don't provision or patch servers. Azure allocates instances, scales them with the incoming load, and on the Consumption and Flex Consumption plans bills you for execution rather than idle capacity. Functions can be written in C#, JavaScript, TypeScript, Python, Java, PowerShell, and other languages through custom handlers.

Typical uses include lightweight APIs, webhooks, scheduled jobs, queue and event processing, and file handling when a blob is uploaded.

Take quiz
Azure Functions is best described as:
a managed relational database engine
a virtual network security appliance
a serverless, event-driven compute service
a container image registry
What causes a function to execute?
A manual restart of the underlying VM
A nightly operating system patch window
A change to the resource group tags
A trigger event such as an HTTP call or a timer

2. What are triggers in Azure Functions?

A trigger defines how a function is invoked. It listens to an event source, and when the event occurs it starts the function and passes the event payload in as a parameter.

Every function has exactly one trigger. If you need to react to two different sources, you write two functions. Common triggers are HTTP, Timer, Blob, Queue, Service Bus, Event Hubs, Event Grid, and Cosmos DB.

The trigger type also decides how the function scales, because the platform watches that source (queue depth, partition lag, request rate) to add or remove instances.

Take quiz
How many triggers can one function have?
Up to three
Unlimited, as long as they share a name
None, because bindings start functions
Exactly one
What does a trigger supply to the function?
The event payload that caused the invocation
The hosting plan's billing record
A copy of host.json
The deployment slot name

3. What are bindings in Azure Functions?

Bindings are a declarative way to connect a function to other services without writing the connection code yourself. You describe the resource, and the runtime reads from it or writes to it for you.

An input binding pulls data in (for example, a Cosmos DB document or a blob). An output binding sends data out (for example, adding a message to a queue). A trigger is a special kind of input binding that also starts the function.

Kind Direction Example
Trigger In (starts the function) Queue message arrives
Input binding In Read a blob by name
Output binding Out Write a row to Table storage

Bindings are optional. A function needs a trigger, but you can skip bindings and use an SDK client directly when you need more control.

Take quiz
Which binding kind writes data produced by the function to another service?
Output binding
Input binding
Trigger
Host binding
Are bindings required for every function?
Yes, at least one input and one output
No, only a trigger is required
Yes, but only on the Premium plan
No, but only on Linux

4. What are the hosting plans available for Azure Functions?

Azure Functions can run on five hosting options. They differ mainly in scaling behaviour, cold start, networking features, and how you are billed.

Plan Scaling Notable trait
Consumption Event-driven, scales to zero Pay per execution and GB-seconds; cold starts; no VNet integration
Flex Consumption Event-driven, per-function scaling Linux only; always-ready instances; VNet support
Premium (Elastic Premium) Event-driven with pre-warmed instances No cold start for warm instances; VNet; longer runs
Dedicated (App Service) Manual or autoscale rules Runs on VMs you already pay for; needs Always On
Container Apps KEDA-based scaling Run containerized function apps alongside other microservices

Most new serverless workloads should evaluate Flex Consumption first, then Premium if they need other capabilities.

Take quiz
Which plan runs functions on VMs you already pay for in an App Service plan?
Consumption plan
Dedicated (App Service) plan
Flex Consumption plan
Container Apps plan
Which classic plan bills only for executions and GB-seconds and scales to zero?
Premium plan
Dedicated plan
Consumption plan
Azure Kubernetes Service

5. What is a function app in Azure?

A function app is the deployment and management unit for Azure Functions. It is the container that hosts one or more individual functions.

All functions in an app share the same hosting plan, runtime version, app settings, and deployment. On Consumption and Premium plans they also scale together as one unit. Flex Consumption is the exception, since it scales some trigger groups (HTTP, Durable, Blob via Event Grid) independently.

Group related functions that change and scale together in one app. Put functions with very different load profiles or language stacks in separate apps.

Take quiz
What do functions inside one function app share?
Their trigger types
Their individual timeout values only
Hosting plan, runtime version, and app settings
Their function keys exclusively
On a Consumption plan, what is the unit of scale?
Each individual function on its own
Each trigger type across the subscription
Each deployment slot name
The whole function app

6. List the commonly used triggers in Azure Functions?

Azure Functions ships with triggers for most Azure services. These are the ones that come up most in practice:

Trigger Fires when
HTTP A web request hits the function URL
Timer A CRON schedule is due
Blob A blob is added or updated in a container
Queue A message lands in an Azure Storage queue
Service Bus A message arrives in a queue or topic subscription
Event Hubs Events arrive on a partition of an event hub
Event Grid An Event Grid subscription pushes an event
Cosmos DB A document is inserted or updated in the change feed

Kafka, SignalR, RabbitMQ, and SQL triggers are also available through extensions.

Take quiz
Which trigger runs a function on a CRON-style schedule?
Blob trigger
Event Grid trigger
Cosmos DB trigger
Timer trigger
Which trigger is designed for high-throughput telemetry streams?
Event Hubs trigger
Timer trigger
HTTP trigger
Queue trigger with one message per day

7. How do you create an HTTP-triggered function?

Add a method with the HttpTrigger attribute on its first parameter. The attribute sets the authorization level and the allowed HTTP methods. This is a C# isolated worker example with ASP.NET Core integration:

[Function("Hello")]
public IActionResult Run(
    [HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req)
{
    string name = req.Query["name"];
    return new OkObjectResult($"Hello, {name ?? "world"}");
}

You can scaffold the same thing with func new --template "HTTP trigger". One limit to remember: an HTTP response must start within 230 seconds on every plan, because of the Azure load balancer idle timeout. Longer jobs should return 202 Accepted and finish in the background.

Take quiz
Which attribute marks the HTTP-triggered parameter in C#?
HttpTrigger
QueueTrigger
FunctionName only
RouteBinding
What is the maximum time an HTTP-triggered function has to respond, on any plan?
5 minutes
230 seconds
30 minutes
10 minutes

8. What is the Timer trigger and how do you schedule it?

The Timer trigger runs a function on a schedule. The schedule is an NCRONTAB expression with six fields: {second} {minute} {hour} {day} {month} {day-of-week}.

Expression Meaning
0 */5 * * * * Every 5 minutes
0 30 2 * * * Daily at 02:30
0 0 9 * * 1-5 09:00 on weekdays

Times are in UTC unless you set the WEBSITE_TIME_ZONE app setting. You can also store the expression in an app setting and refer to it as %MY_SCHEDULE% so it can change without redeploying.

Take quiz
How many fields does an Azure Functions NCRONTAB expression have?
Five
Six
Seven
Four
What does the expression 0 */10 * * * * do?
Runs every 10 seconds
Runs once every 10 hours
Runs every 10 minutes
Runs on the 10th day of each month

9. What programming languages does Azure Functions support?

Azure Functions has first-class support for C# and F# (.NET), JavaScript, TypeScript, Python, Java, and PowerShell. The exact versions depend on the runtime version you target.

Any other language, such as Go or Rust, can run through a custom handler, where the Functions host forwards events to your own HTTP server process.

Newer programming models are code-first. Python v2 uses decorators and Node.js v4 registers functions in code, so neither needs a hand-written function.json. Check the supported runtime versions for each language before choosing, since they change as the platform evolves.

Take quiz
How can you run a function written in Go or Rust?
Only by converting it to Java
By using the Timer trigger template
Through a custom handler
It is impossible on any plan
The Python v2 programming model defines functions using:
A mandatory function.json per function
XML workflow files
The Logic Apps designer
Decorators in code

10. What is the purpose of host.json in Azure Functions?

host.json holds global configuration that applies to every function in the function app. It controls the behaviour of the Functions host rather than any one function.

Typical settings are functionTimeout, logging and Application Insights sampling, extension bundle version, retry policy, and trigger tuning such as queue batchSize or Service Bus maxConcurrentCalls. Changes take effect when the app restarts, and the file is deployed together with your code.

{
  "version": "2.0",
  "functionTimeout": "00:10:00",
  "logging": {
    "applicationInsights": { "samplingSettings": { "isEnabled": true } }
  }
}

Take quiz
Where do you configure functionTimeout?
local.settings.json
function.json of each function
The trigger attribute only
host.json
host.json settings apply to:
All functions in the function app
Only the first function alphabetically
Only HTTP-triggered functions
Only the local development machine

11. What is the purpose of local.settings.json?

local.settings.json stores app settings and connection strings for local development. Core Tools reads it when you run func start, and the values show up as environment variables in your code.

It is never published to Azure. In the cloud, the same values live in the function app's application settings. Because it often holds secrets, keep it out of source control. It also carries a Host section for local settings such as the port and CORS origins, and a ConnectionStrings section for named connections.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
  }
}

Take quiz
Is local.settings.json deployed to Azure by default?
No, it is for local use only
Yes, it replaces host.json
Yes, but only for Python apps
Only when Always On is enabled
What does UseDevelopmentStorage=true point to?
A production storage account
The Azurite storage emulator
A Cosmos DB account
The Application Insights workspace

12. What is function.json and when is it used?

function.json is a per-function metadata file that declares the function's trigger, bindings, and their direction. The host reads it to know what to listen to and what to inject.

You write it by hand for script-style languages in the older models, such as JavaScript v3, Python v1, and PowerShell. Code-first models, including C# attributes, Python v2, and Node.js v4, generate the equivalent metadata at build time.

{
  "bindings": [
    { "type": "queueTrigger", "direction": "in", "name": "msg", "queueName": "orders", "connection": "AzureWebJobsStorage" },
    { "type": "blob", "direction": "out", "name": "outBlob", "path": "archive/{rand-guid}.json", "connection": "AzureWebJobsStorage" }
  ]
}

Take quiz
What does function.json describe?
The scaling limits of the hosting plan
The trigger and bindings of a function
The Application Insights sampling rate
The deployment pipeline stages
In a binding definition, what does "direction": "out" mean?
The function is disabled
The trigger is paused
The binding writes data from the function
The binding reads from a blob only

13. What are the authorization levels in Azure Functions?

HTTP-triggered functions use one of three authorization levels, set in the HttpTrigger attribute.

Level Requirement
Anonymous No key needed
Function A function-specific key or a host key
Admin The master (host) key only

Send the key in the code query string or, better, in the x-functions-key header. Keys are shared secrets, so treat them as a basic safeguard and not as real user authentication. For user-level security, use Microsoft Entra ID through built-in authentication. Rotate keys regularly, and never embed them in client-side code, where anyone can read them.

Take quiz
Which authorization level requires the master key?
Anonymous
Function
Admin
User
How can a caller send a function key without exposing it in the URL?
In the response body
In the host.json file
In the Content-Type header
In the x-functions-key header

14. What is Azure Functions Core Tools?

Azure Functions Core Tools is a command-line toolset for creating, running, and deploying function apps from your machine. It includes the same Functions host that runs in Azure, so what you debug locally behaves closely like production.

  1. func init creates a new project.
  2. func new adds a function from a template.
  3. func start runs the host locally.
  4. func azure functionapp publish <APP_NAME> deploys to Azure.

For queue, blob, or timer triggers you also need a storage target locally. Azurite is the usual choice.

Take quiz
Which command starts the Functions host on your machine?
func init
func publish --local
func new
func start
What does func azure functionapp publish do?
Deploys the project to a function app in Azure
Starts Azurite
Deletes the local settings file
Creates a new storage account

15. What is the purpose of the AzureWebJobsStorage setting?

AzureWebJobsStorage points to the storage account the Functions runtime uses internally. It is not just for your data.

The host uses it to keep Event Hubs checkpoints, blob receipts, timer singleton locks, function keys, and the state of Durable Functions. If the connection is wrong or the account is unreachable, many triggers silently stop firing.

It is required for every trigger type except HTTP, and it is still recommended for HTTP-only apps. You can use identity-based access with AzureWebJobsStorage__accountName instead of a connection string.

Take quiz
Which of these does the runtime keep in the AzureWebJobsStorage account?
Event Hubs checkpoints and timer locks
Your application source code
Entra ID user passwords
Azure Monitor dashboards
Which setting enables identity-based access to the runtime storage?
AzureWebJobsStorage__disable
AzureWebJobsStorage__accountName
FUNCTIONS_WORKER_RUNTIME__identity
WEBSITE_STORAGE_ROLE

16. What are Durable Functions?

Durable Functions is an extension of Azure Functions that lets you write stateful workflows in code while staying serverless. The framework checkpoints progress for you, so a workflow can pause for hours or days and resume after a restart.

It adds four building blocks:

  • Client functions start and query orchestrations.
  • Orchestrator functions define the workflow steps.
  • Activity functions do the actual work.
  • Entity functions hold small pieces of state.

It suits chaining, parallel processing, long-running approvals, and retry-heavy flows. State is stored in a task hub, which by default uses Azure Storage but can use other providers.

Take quiz
Which Durable Functions type defines the order of workflow steps?
Activity function
Orchestrator function
Timer function
Client binding
Which type performs the real unit of work, such as calling an API?
Orchestrator function
Entity trigger only
Activity function
host.json

17. How do you deploy an Azure Functions app?

There are several supported routes. The right one depends on how repeatable you need the process to be.

  • Core Tools: func azure functionapp publish for quick manual deploys.
  • Zip deploy / run from package: upload a zip and set WEBSITE_RUN_FROM_PACKAGE=1 so the app runs read-only from the package.
  • CI/CD: GitHub Actions (Azure/functions-action) or Azure Pipelines.
  • VS Code and Visual Studio: publish from the IDE.
  • Containers: push an image and point a Premium, Dedicated, or Container Apps host at it.

For teams, a pipeline with infrastructure as code (Bicep or Terraform) plus a staging slot or a validation step is the safest pattern. Flex Consumption uses its own one-deploy package flow.

Take quiz
Which app setting makes the app run directly from a deployment zip?
AzureWebJobsStorage
FUNCTIONS_EXTENSION_VERSION only
WEBSITE_RUN_FROM_PACKAGE
WEBSITE_LOAD_USER_PROFILE
Which approach is best for repeatable team deployments?
Editing files in the portal editor
Copying files over FTP by hand
Redeploying from a laptop each time
A CI/CD pipeline such as GitHub Actions

18. How do you monitor Azure Functions?

The standard tool is Application Insights. Connect it by setting APPLICATIONINSIGHTS_CONNECTION_STRING on the function app, and the host starts sending traces, requests, dependencies, and exceptions automatically.

  • Live Metrics for real-time debugging.
  • Failures and Performance blades for exceptions and slow dependencies.
  • Logs (KQL) for custom queries on the requests and traces tables.
  • Alerts on failure rate or execution count.

To control cost, configure sampling in host.json. You can also write your own logs through ILogger, and those messages appear in the traces table with the invocation ID, so you can follow a single run end to end.

Take quiz
Which setting connects a function app to Application Insights?
AzureWebJobsDashboard only
WEBSITE_TIME_ZONE
FUNCTIONS_WORKER_RUNTIME
APPLICATIONINSIGHTS_CONNECTION_STRING
What does sampling in host.json help with?
Reducing telemetry volume and cost
Increasing the function timeout
Encrypting app settings
Speeding up cold starts directly

19. How do you store secrets securely in Azure Functions?

Keep secrets out of code and out of local.settings.json in source control. Store them in Azure Key Vault and reference them from app settings.

@Microsoft.KeyVault(SecretUri=https://my-vault.vault.azure.net/secrets/DbPassword/)

Enable a managed identity on the function app and grant it the Key Vault Secrets User role. The platform resolves the reference at runtime, and your code just reads the setting as an environment variable. Application settings are also encrypted at rest. If the vault is behind a firewall, the function app needs network access to it as well, otherwise the reference will fail to resolve and the setting stays empty.

Take quiz
What lets a function app read Key Vault without a stored password?
A managed identity with a Key Vault role
A function key in the URL
A public Key Vault endpoint with no auth
The master key
What does an app setting value starting with @Microsoft.KeyVault(...) do?
Creates a new vault on deployment
Resolves the secret from Key Vault at runtime
Encrypts the host.json file
Disables the setting

20. What is the billing model of the Azure Functions Consumption plan?

The Consumption plan is pay-per-use. You are charged for two things: the number of executions and the resources used while running, measured in gigabyte-seconds (memory multiplied by duration).

Each month includes a free grant of 1 million executions and 400,000 GB-seconds. Memory is rounded up to the nearest 128 MB and time to the nearest millisecond, with a 100 ms minimum per execution.

Because idle time costs nothing, it is cheap for spiky workloads. Steady, heavy workloads often cost less on Premium or Dedicated.

Take quiz
Consumption plan charges are based on:
Reserved vCPU hours per month
Executions and GB-seconds of resource use
The number of function apps in a subscription
Storage account transactions only
What is the monthly free grant on the Consumption plan?
10 million executions and no GB-seconds
100,000 executions and 40,000 GB-seconds
1 million executions and 400,000 GB-seconds
Unlimited executions up to 1 GB

21. What is the difference between Consumption and Premium plans?

Both are event-driven and scale out automatically. The difference is that Premium keeps pre-warmed instances ready and offers more networking and runtime headroom, at a higher baseline cost.

Feature Consumption Premium
Cold start Yes Avoided with always-ready and pre-warmed instances
Scale to zero Yes No, at least one instance stays allocated
VNet integration Not supported Supported
Default timeout 5 minutes (max 10) 30 minutes, can be unbounded
Billing Per execution and GB-seconds Per core-second and memory used by allocated instances

Choose Consumption for sporadic, short jobs. Choose Premium when you need private networking, no cold starts, or long executions.

Take quiz
Which plan supports VNet integration?
Consumption
Neither of them
Premium
Both, with no limits
What is the maximum configurable timeout on the Consumption plan?
30 minutes
60 minutes
Unbounded
10 minutes

22. What is the Flex Consumption plan and why use it?

Flex Consumption is the newer serverless plan that keeps pay-for-use billing but adds features that used to need Premium. It runs on Linux only.

  • Per-function scaling: HTTP, Durable, and Blob (Event Grid) groups scale independently, and other triggers scale per function.
  • Always-ready instances to cut cold starts.
  • VNet integration with private endpoints.
  • Configurable instance memory (512 MB, 2,048 MB, or 4,096 MB) and a high scale-out ceiling.

Limitations to know: it has no deployment slots, so you use rolling updates, and not every region or language version is available yet. For new serverless apps it is generally the first plan to evaluate.

Take quiz
Which operating system does Flex Consumption run on?
Windows only
Both Windows and Linux
macOS
Linux
Which Flex Consumption feature reduces cold starts for chosen triggers?
Always-ready instances
Deployment slots
Dedicated App Service Environment
Local.settings.json

23. What is the difference between in-process and isolated worker models?

These are the two ways to run .NET functions. In the in-process model your code loads into the same process as the Functions host. In the isolated worker model it runs in its own process and talks to the host over gRPC.

Aspect In-process Isolated worker
Process Shared with the host Separate worker process
.NET version Tied to the host's version Any supported .NET, including .NET Framework
Startup control Limited (FunctionsStartup) Full Program.cs with HostBuilder
Middleware No Yes
Support Ends November 10, 2026 Actively developed

New projects should use isolated. Existing in-process apps need to migrate before support ends, since the tooling and new .NET releases target isolated only.

Take quiz
Which model supports middleware and a full Program.cs startup?
Isolated worker
In-process
Both equally
Neither
Why should in-process .NET apps migrate?
The model cannot run HTTP triggers
In-process support ends on November 10, 2026
It only runs on Linux
It does not support queues

24. How does Azure Functions scale?

Scaling is handled by the scale controller, a platform component that watches the event source and decides how many instances the app needs. On Consumption, Flex Consumption, and Premium plans it adds instances when the load grows and removes them when it falls.

What it measures depends on the trigger:

  • Queue: queue length and age of the oldest message.
  • Event Hubs: unprocessed events, capped by the number of partitions.
  • HTTP: concurrent requests and response times.
  • Timer: never scales out, because only one instance runs a schedule.

Consumption on Windows can reach 200 instances per app and Linux 100. You can lower the cap with functionAppScaleLimit to protect a downstream database.

Take quiz
Which component decides when to add or remove instances?
The Application Insights agent
The scale controller
The Azure Resource Manager template
The function.json file
What caps the useful instance count for an Event Hubs trigger?
The size of host.json
The number of function keys
The number of partitions
The deployment slot count

25. What is a cold start and how can you reduce it?

A cold start is the delay on the first request when no warm instance is available. Azure has to allocate a worker, start the host and language runtime, and load your code before the function can run.

It mostly affects the Consumption plan after idle periods. These steps help:

  1. Use always-ready instances (Flex Consumption) or pre-warmed instances (Premium).
  2. Deploy with WEBSITE_RUN_FROM_PACKAGE so file loading is fast.
  3. Trim dependencies and avoid heavy work in startup code.
  4. Prefer lighter runtimes where latency matters, and reuse clients instead of creating them on each call.
  5. As a last resort, use a timer ping, though it is no substitute for a plan that has warm capacity.
Take quiz
Which option removes cold starts for selected instances?
Deployment slots on Consumption
A larger storage account
Always-ready or pre-warmed instances
Disabling Application Insights
What commonly makes cold starts worse?
Using managed identity
Setting a short timeout
Naming functions in lowercase
Heavy dependency initialization at startup

26. What is the difference between Azure Functions and Logic Apps?

Both are serverless and event-driven, but Functions is code-first and Logic Apps is designer-first. Functions gives you full control through code. Logic Apps connects services visually with prebuilt connectors.

Aspect Azure Functions Logic Apps
Authoring Code in C#, Python, JS, and more Visual designer or JSON workflow
Integration Triggers and bindings, SDKs Hundreds of managed connectors
Best for Custom logic, algorithms, APIs Workflow orchestration and SaaS integration
Monitoring Application Insights Run history per workflow step

They are often combined. A Logic App handles the workflow and approvals, and calls a function for any step that needs custom code.

Take quiz
Which service is a low-code, designer-driven workflow tool?
Azure Functions
Azure Storage
Azure Policy
Logic Apps
Which fits best when you need a custom algorithm written in C#?
Azure Functions
Logic Apps designer actions only
Azure DNS
Azure Monitor

27. What is the difference between Azure Functions and WebJobs?

Azure Functions is built on the WebJobs SDK, so they share the trigger and binding model. The difference is the hosting and scaling experience.

Aspect WebJobs Azure Functions
Hosting Inside an App Service app, sharing its plan Own function app on Consumption, Flex, Premium, or Dedicated
Scaling Scales with the App Service plan Event-driven scale controller
Billing Part of the App Service plan Per execution on serverless plans
Setup Needs Always On for continuous jobs Templates, Core Tools, and a managed host

Pick WebJobs only when you already have an App Service app and want a background job next to it. Otherwise Functions is the better default.

Take quiz
The Azure Functions runtime is built on:
The WebJobs SDK
Azure Kubernetes Service
Logic Apps runtime
Azure Batch
WebJobs run:
On a scale controller that scales to zero
Inside an App Service app, sharing its plan
Only on Consumption
Only inside containers

28. How do you implement dependency injection in isolated.NET Azure Functions?

In the isolated worker model you build the host yourself in Program.cs and register services on the IServiceCollection. Functions then receive them through constructor injection.

var host = new HostBuilder()
    .ConfigureFunctionsWebApplication()
    .ConfigureServices(services =>
    {
        services.AddHttpClient();
        services.AddSingleton<IOrderService, OrderService>();
    })
    .Build();

host.Run();

public class OrderFunctions(IOrderService orders, ILogger<OrderFunctions> log)
{
    [Function("GetOrder")]
    public IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req) { ... }
}

Use IHttpClientFactory instead of creating HttpClient per call, since that avoids socket exhaustion. Choose lifetimes carefully, because singletons are shared across concurrent invocations.

Take quiz
Where do you register services in an isolated function app?
In function.json
In Program.cs through ConfigureServices
In local.settings.json
In the HttpTrigger attribute
Why register HttpClient through IHttpClientFactory?
To disable TLS
To stop the function from scaling
To avoid socket exhaustion and reuse connections
To encrypt app settings

29. How does the Queue trigger handle poison messages?

When a queue-triggered function throws, the message returns to the queue after its visibility timeout and is picked up again. The host tracks the dequeue count on the message.

After the count reaches maxDequeueCount (default 5), the runtime moves the message to a queue named <originalqueue>-poison and stops retrying it. You can then inspect it, fix the bug, and requeue it.

{
  "extensions": {
    "queues": { "maxDequeueCount": 3, "batchSize": 16, "visibilityTimeout": "00:00:30" }
  }
}

Add a second function with a trigger on the poison queue if you want alerts or automated handling.

Take quiz
What is the default maxDequeueCount for the Queue trigger?
1
10
5
100
What is the poison queue for a queue named orders called?
orders-deadletter
poison-orders-queue
orders/failed
orders-poison

30. How does the Service Bus trigger handle message completion and dead-lettering?

By default the extension completes the message automatically when your function returns without an error. If the function throws, the message is abandoned and becomes available again for another attempt.

Each attempt increments the delivery count. When it exceeds the queue or subscription's MaxDeliveryCount (default 10), Service Bus moves the message to the dead-letter queue. You can also dead-letter explicitly through ServiceBusMessageActions when you set autoCompleteMessages to false.

For ordered processing, enable sessions so each session is handled by one consumer at a time.

Take quiz
What happens to a Service Bus message when the function throws?
It is deleted immediately
It is moved to a blob container
It is completed anyway
It is abandoned and retried
Where does a message go after exceeding MaxDeliveryCount?
The dead-letter queue
The poison queue in Azure Storage
A new topic named failed
The Event Grid dead letter store

31. How does the Event Hubs trigger scale and checkpoint?

Event Hubs splits a stream into partitions. The trigger assigns each partition to one instance at a time, which preserves ordering within that partition. That means the number of partitions is the ceiling on parallel instances.

The function receives events in batches when cardinality is set to many. After a batch finishes successfully, the host writes a checkpoint (offset and sequence number) to a blob container in the AzureWebJobsStorage account. If an instance dies, another resumes from the last checkpoint.

Because a checkpoint covers the batch, a failure can replay events. Make handlers idempotent, and use batch size and prefetch settings in host.json to tune throughput.

Take quiz
Where does the Event Hubs trigger store checkpoints?
In blob storage of the AzureWebJobsStorage account
In the Event Hubs namespace's key vault
In Cosmos DB by default
In the function app's host.json
How many instances read one partition at the same time?
All instances in the app
One
Two for redundancy
As many as the batch size

32. What is the difference between Event Grid trigger and Blob trigger for blobs?

Both can start a function when a blob changes, but they detect changes differently. The classic Blob trigger polls the container and uses blob receipts, while an Event Grid-based setup is pushed by the storage account.

Aspect Polling Blob trigger Event Grid (event-based)
Detection Scans container and logs Push event on create or delete
Latency Can be up to minutes on Consumption Typically seconds
Large containers Scanning gets slow and costly Not affected by container size
Deletes Not detected Can trigger on delete

Use the event-based mode for production workloads. Flex Consumption supports only the event-based Blob trigger.

Take quiz
Which approach gives the lowest-latency blob detection?
Polling the container on a timer
Event Grid push events
Reading blob metadata daily
Checking host.json
Which blob trigger source does Flex Consumption support?
Polling only
Timer-based scanning
Event-based (Event Grid)
No blob trigger at all

33. How do you configure retry policies in Azure Functions?

Built-in retry policies re-run a function when it throws. There are two strategies: fixed delay, which waits the same interval between attempts, and exponential backoff, where the wait grows each time up to a maximum.

You can set them per function with an attribute, or for the whole app in host.json:

[Function("ProcessOrder")]
[FixedDelayRetry(5, "00:00:10")]
public void Run([TimerTrigger("0 */5 * * * *")] TimerInfo timer) { ... }

{
  "retry": {
    "strategy": "exponentialBackoff",
    "maxRetryCount": 5,
    "minimumInterval": "00:00:05",
    "maximumInterval": "00:15:00"
  }
}

These policies apply to non-HTTP triggers that support them, such as Timer, Event Hubs, and Cosmos DB. Queue and Service Bus triggers use their own redelivery rules, and HTTP clients must retry on their side.

Take quiz
Which trigger type does not use the built-in retry policy?
Timer trigger
Event Hubs trigger
HTTP trigger
Cosmos DB trigger
What does exponential backoff do?
Retries all attempts at once
Keeps the delay constant
Skips the failed event
Increases the delay between each retry

34. How does the Timer trigger behave when the app runs on multiple instances?

Only one instance runs a given schedule at any moment. The Timer extension uses the singleton lock pattern, taking a blob lease in the AzureWebJobsStorage account. The instance that holds the lease fires the schedule, and the others skip it.

If that instance goes down, another takes the lease and continues. A missed run is reported through TimerInfo.IsPastDue when the host starts late.

Be careful with RunOnStartup, which fires the function every time the host starts, including each scale-out or deployment. It is meant for testing and should not be on in production. Also, a staging slot runs timers too unless you disable the function there.

Take quiz
How does the Timer trigger stop duplicate runs across instances?
Each instance picks a random minute
Azure disables scale-out for timer apps
Function keys are compared at runtime
A blob lease in the storage account acts as a singleton lock
What does RunOnStartup do?
Runs the function whenever the host starts
Delays the first schedule by a day
Runs only after a swap
Disables the singleton lock

35. Why must Durable Functions orchestrator code be deterministic?

Orchestrators use event sourcing. After each await, the framework saves history to the task hub, and when the orchestrator resumes it replays the code from the top, using the saved history to skip completed steps.

Replay only works if the code takes the same path each time. If a replay produces a different sequence of calls than the history recorded, you get a non-determinism error or corrupt workflow state.

Avoid in orchestrators:

  • DateTime.Now (use context.CurrentUtcDateTime)
  • Guid.NewGuid() (use context.NewGuid())
  • Random numbers, environment reads that can change, and direct network or file I/O
  • Task.Delay (use context.CreateTimer)

Put anything non-deterministic inside an activity function, which runs once and has its result recorded.

Take quiz
Which API should an orchestrator use to get the current time?
context.CurrentUtcDateTime
DateTime.Now
Stopwatch.GetTimestamp()
Environment.TickCount
Where should I/O such as database calls go in a Durable workflow?
Directly inside the orchestrator
Inside activity functions
In host.json
In the Timer trigger only

36. Explain the execution flow of a Durable Functions orchestration?

A client function starts an orchestration by writing a start message to the task hub (storage-backed queues and tables by default). The orchestrator is triggered, runs until it hits an await on an activity, and then unloads.

  1. The orchestrator schedules an activity and saves that fact to the history table.
  2. The activity runs, and its result is written back as a new history event.
  3. The orchestrator is triggered again and replays from the start, using history to return stored results instead of re-running activities.
  4. It continues past the completed step to the next await, and the cycle repeats until the workflow returns.
sequenceDiagram
  participant C as Client function
  participant H as Task hub (history)
  participant O as Orchestrator
  participant A as Activity
  C->>H: Start orchestration
  H->>O: Trigger
  O->>H: Schedule activity, then unload
  H->>A: Run activity
  A->>H: Save result
  H->>O: Trigger again (replay)
  O->>H: Mark completed
Take quiz
What does the orchestrator do after scheduling an activity?
Blocks the thread until the activity ends
Saves state and unloads until the result returns
Deletes its history
Restarts the host
When an orchestrator replays, completed activities are:
Executed again from scratch
Skipped and treated as failed
Not re-executed; their stored results are returned
Moved to a poison queue

37. What are the common Durable Functions application patterns?

Durable Functions has a handful of well-known patterns that cover most workflow needs.

Pattern What it does Example
Function chaining Run steps in order, passing output to the next Validate, charge, ship
Fan-out/fan-in Run many tasks in parallel, then combine results Process every file in a folder
Async HTTP API Return 202 with a status URL while work continues Long report generation
Monitor Poll until a condition is met, with flexible intervals Wait for a job to finish
Human interaction Wait for an external event with a timeout Manager approval
Aggregator (entities) Collect events into one stateful object Running totals per device

Pick the pattern first, then map it to orchestrators, activities, and entities.

Take quiz
Which pattern returns HTTP 202 with a status URL while work continues?
Function chaining
Aggregator
Async HTTP API
Fan-in only
Which pattern suits an approval that waits for a person, with a timeout?
Fan-out/fan-in
Function chaining
Timer-only trigger
Human interaction

38. Explain the fan-out/fan-in pattern in Durable Functions?

Fan-out starts many activity functions in parallel, and fan-in waits for all of them and combines their results. The orchestrator is what holds the list of tasks and awaits them together.

[Function("ProcessFiles")]
public static async Task<int> Run(
    [OrchestrationTrigger] TaskOrchestrationContext context)
{
    var files = await context.CallActivityAsync<string[]>("GetFiles", null);

    var tasks = files.Select(f => context.CallActivityAsync<int>("ProcessFile", f));
    int[] results = await Task.WhenAll(tasks);

    return results.Sum();
}

The activities spread across available instances, so throughput scales with the app. Remember that checkpoint history grows with the number of tasks, so for very large fan-outs consider sub-orchestrations or batching. Make activities idempotent, since a retry can run one twice.

Take quiz
Which call waits for all parallel activities in the fan-in step?
Task.Delay
Thread.Sleep
Task.Run
Task.WhenAll
What does fan-in refer to?
Aggregating the results of parallel tasks
Starting tasks one after another
Sending one message to every queue
Splitting a blob into chunks

39. What are Durable entities and when would you use them?

Durable entities are small stateful objects, each identified by an entity name and key. Operations on one entity are processed one at a time, so you get safe state updates without writing locking code.

An entity can be signalled (fire-and-forget) from a client or orchestrator, or called and awaited from an orchestrator. State is persisted for you.

  • A counter or running total per device or user
  • A shopping cart or rate limiter
  • A circuit breaker or distributed lock
  • Aggregating events from many sources into one record

Avoid them for large datasets, since each entity is meant to hold small state. A database is a better home for big or queryable data.

Take quiz
How are operations on a single Durable entity processed?
Serially, one at a time
In parallel across all instances
Only on Sundays
Only when the host restarts
Which is a good use for a Durable entity?
Storing a 5 GB video
A per-device running counter
Hosting a static website
Replacing a SQL data warehouse

40. How do you secure an HTTP-triggered function beyond function keys?

Function keys are shared secrets, so they identify an app, not a user. For real security, layer several controls:

  1. Built-in authentication (Easy Auth) with Microsoft Entra ID, so callers present a valid token.
  2. Azure API Management in front, validating JWTs, applying rate limits, and hiding the function URL.
  3. Network restrictions: access restrictions or private endpoints so only trusted callers reach the app.
  4. HTTPS only with a minimum TLS version and a tight CORS allow-list.
  5. Managed identity for outbound calls so no credentials are stored in code.

Use AuthorizationLevel.Anonymous in code when Easy Auth or API Management handles authentication, and keep the function itself off the public internet where possible.

Take quiz
Why are function keys not enough for user-level security?
They expire every hour automatically
They are shared secrets that identify the app, not a user
They only work on Linux
They are always visible in Azure Monitor
Which service can validate JWTs and apply rate limits in front of a function?
Azure Blob Storage
Azure Batch
Azure API Management
Azure Backup

41. How do you use managed identity in Azure Functions?

A managed identity gives the function app an identity in Microsoft Entra ID, so it can call other Azure services without keys or connection strings.

Type Lifecycle Use when
System-assigned Tied to the function app, deleted with it One app needs its own access
User-assigned Independent resource, can be shared Several apps need the same access

  1. Enable the identity on the function app.
  2. Assign it an Azure RBAC role on the target, for example Storage Blob Data Contributor.
  3. Authenticate in code with DefaultAzureCredential, or use identity-based binding settings.

For triggers and bindings, replace connection strings with settings such as AzureWebJobsStorage__accountName or ServiceBusConnection__fullyQualifiedNamespace.

Take quiz
Which identity type can be shared by multiple function apps?
System-assigned
Anonymous
User-assigned
Admin
What setting style enables identity-based connections for the runtime storage?
AzureWebJobsStorage=keyless
STORAGE_IDENTITY_ENABLED
FUNCTIONS_MANAGED_KEY
AzureWebJobsStorage__accountName

42. How does VNet integration work with Azure Functions?

VNet integration controls outbound traffic from the function app through a delegated subnet, so it can reach private resources such as a database behind a private endpoint. Inbound traffic is handled separately with private endpoints or access restrictions.

Plan VNet integration Private endpoint (inbound)
Consumption No No
Flex Consumption Yes Yes
Premium Yes Yes
Dedicated Yes Yes

If the runtime storage account is also locked behind a firewall, the app needs access to it through the VNet, and the content share settings must be configured to match. A broken storage path is a common reason a locked-down app stops starting.

Take quiz
Which plan does not support VNet integration?
Premium
Flex Consumption
Dedicated
Consumption
Which traffic does VNet integration control?
Outbound traffic from the function app
Billing data
Inbound public DNS queries only
Deployment package size

43. What are the execution timeout limits across Azure Functions plans?

Timeouts are set with functionTimeout in host.json, and the allowed range depends on the plan.

Plan Default Maximum
Consumption 5 minutes 10 minutes
Flex Consumption 30 minutes Unbounded
Premium 30 minutes Unbounded
Dedicated 30 minutes Unbounded

HTTP-triggered functions have a separate hard limit: the response must start within 230 seconds whatever the plan. For longer work, return 202 and continue asynchronously with a queue or Durable Functions. Also remember that unbounded does not mean the platform will never recycle an instance, so long jobs should checkpoint their progress.

Take quiz
What is the default timeout on the Consumption plan?
5 minutes
30 minutes
230 seconds
1 hour
How should you handle an HTTP job that takes 10 minutes?
Raise the HTTP limit above 230 seconds in host.json
Return 202 and finish asynchronously
Switch to the Timer trigger
Disable the load balancer

44. How do you make Azure Functions idempotent?

Triggers like Queue, Service Bus, and Event Hubs offer at-least-once delivery, so the same message can reach your function more than once after a retry, timeout, or failover. An idempotent function produces the same end state however many times it runs.

  • Use natural idempotent operations: upsert by key instead of insert, set instead of increment.
  • Track an idempotency key: record the message ID or business key in a table and skip it if already processed.
  • Use optimistic concurrency: ETags or version columns prevent double updates.
  • Use broker features: Service Bus duplicate detection drops repeated message IDs within a window.
  • Order matters: write the result first, then mark the message as processed, so a crash leads to a safe replay.

Pair this with retry and poison handling, so repeated failures end up in a queue you can review.

Take quiz
Why does a function need to be idempotent?
Because functions never scale out
Triggers can deliver the same message more than once
Because HTTP triggers reject duplicates
Because host.json forbids retries
Which Service Bus feature helps drop duplicate sends?
Auto-forwarding
Message deferral
Duplicate detection
Partitioning

45. How can you optimize Azure Functions performance?

Start by finding the bottleneck in Application Insights, then apply the changes that fit.

  1. Reuse connections: share HttpClient, database, and SDK clients through DI instead of creating them per invocation.
  2. Be async end to end: blocking calls tie up worker threads and limit throughput.
  3. Batch where possible: process Event Hubs and Service Bus messages in batches rather than one at a time.
  4. Keep functions short: split long work using queues or Durable Functions.
  5. Tune concurrency in host.json, such as batchSize or maxConcurrentCalls.
  6. Choose the right plan: Premium or Flex always-ready instances for latency-sensitive paths.
  7. Trim package size and use run from package for faster starts.
  8. Don't share one storage account between many busy apps, since runtime calls can throttle.

Re-measure after each change so you know which one actually helped.

Take quiz
Why share an HttpClient instead of creating one per call?
To increase the function timeout
To skip authentication
To avoid socket exhaustion and connection setup cost
To disable logging
Which change helps most when an Event Hubs function handles events one by one?
Reduce the partition count to one
Disable checkpoints
Move the code to the Timer trigger
Process events in batches

46. How do you troubleshoot an Azure Function that is not triggering?

Work from the host outward. Most trigger problems are configuration, not code.

  1. Check the function is enabled. An app setting named AzureWebJobs.<FunctionName>.Disabled=true turns it off.
  2. Check host health. Look in Application Insights or the Log stream for startup errors, bad host.json, or runtime mismatches.
  3. Validate AzureWebJobsStorage. A bad key or firewall block stops most triggers.
  4. Match connection names. The Connection property must name an existing app setting, and queue or container names must be exact.
  5. Sync triggers. After some ARM or container deployments, run Sync triggers so the scale controller knows about them.
  6. Check networking. A private event source needs VNet integration and DNS that resolves.
  7. Test the event source. Send a known message and watch Live Metrics.

If the function runs but fails, switch to exceptions in the Failures blade instead.

Take quiz
Which app setting disables a single function?
FUNCTIONS_DISABLED_LIST
WEBSITE_SKIP_TRIGGER
AzureWebJobsDisabled
AzureWebJobs.<FunctionName>.Disabled
After certain deployments, triggers may not fire until you:
Sync the triggers
Rename the resource group
Delete host.json
Disable Application Insights

47. When should you choose Azure Functions over Container Apps or AKS?

The choice depends on how much control you need versus how much you want Azure to manage.

Option Choose it when Trade-off
Azure Functions Short, event-driven tasks, glue code, scheduled jobs, rapid delivery Less control over runtime and process model
Container Apps Long-running services, custom containers, microservices, Dapr or KEDA scaling More to configure than Functions
AKS Full Kubernetes control, custom networking and operators, large platform teams You operate the cluster

Functions also runs on Container Apps, so you can keep the programming model and still share an environment with other containers. Avoid Functions for heavy long-lived processing or when you need custom OS-level dependencies that a managed runtime can't provide.

Take quiz
Which option gives you full Kubernetes control?
AKS
Azure Functions Consumption
Logic Apps
Azure Event Grid
Azure Functions is the best fit for:
A custom OS kernel module
Short, event-driven tasks and scheduled jobs
Running a full Kubernetes operator
A stateful database cluster

48. How do deployment slots work in Azure Functions?

A deployment slot is a live, separate instance of your function app with its own hostname and configuration. You deploy to a staging slot, test it, and swap it into production, which warms the new code first and avoids downtime.

Slots are supported on Premium and Dedicated plans. Flex Consumption does not offer slots and relies on rolling updates instead.

  • Mark settings as slot settings (sticky) if they should stay with the slot, such as a staging connection string.
  • A swap can roll back by swapping again.
  • Timer, queue, and other triggers run in every slot, so disable them in staging with AzureWebJobs.<name>.Disabled to prevent double processing.

HTTP functions are the easiest to swap. For queue-based apps, plan the cutover carefully.

Take quiz
What is the purpose of a sticky (slot) setting?
It moves to production on every swap
It stays with the slot during a swap
It disables the slot
It encrypts the swap
What risk comes with non-HTTP triggers in a staging slot?
They are billed at double price
They disable the production app
They can process the same events as production
They cannot be monitored

49. How do you control concurrency in Azure Functions?

Concurrency can be tuned at three levels: inside one instance, across worker processes, and across instances.

Level Setting Effect
Per instance (HTTP) http.maxConcurrentRequests Limits parallel HTTP requests
Per instance (Queue) batchSize, newBatchThreshold Controls how many messages are processed at once
Per instance (Service Bus) maxConcurrentCalls Limits concurrent message handlers
Worker processes FUNCTIONS_WORKER_PROCESS_COUNT Number of language worker processes per host
Scale-out functionAppScaleLimit Maximum instances

Dynamic concurrency lets the host adjust parallelism automatically based on CPU and memory, and you enable it with concurrency.dynamicConcurrencyEnabled in host.json. For strictly one-at-a-time execution, use the Singleton attribute. Always size the limits against what the downstream database can handle.

Take quiz
Which setting limits concurrent Service Bus message handlers per instance?
batchSize on Queue only
functionTimeout
maxConcurrentCalls
FUNCTIONS_EXTENSION_VERSION
What does dynamic concurrency do?
Disables scale-out
Fixes concurrency at one
Moves work to a different region
Adjusts parallelism automatically based on resource use

50. Explain the internal working of the Azure Functions host and scale controller?

Two pieces cooperate. The scale controller sits outside your app and watches event sources to decide instance counts. The Functions host runs on each instance and executes your functions.

  1. The scale controller monitors triggers (queue depth, partition lag, request rate) and tells the platform to add or remove instances.
  2. On each instance, the host starts, reads host.json and the function metadata, and starts a listener for each trigger.
  3. When an event arrives, the host resolves input bindings and sends an invocation to the language worker over gRPC (the isolated worker or runtime for Node, Python, Java).
  4. The worker runs your code and returns the result, and the host handles output bindings, checkpoints, and logging.
flowchart LR
  SC["Scale controller"] -->|add or remove instances| I["Function instance"]
  ES[(Event source)] --> L["Host listener"]
  SC -.monitors.-> ES
  subgraph I["Function instance"]
    L --> H["Functions host"]
    H -->|gRPC| W["Language worker"]
    W --> F["Your function code"]
  end
  F --> OB["Output bindings and logs"]
Take quiz
Which component decides how many instances an app needs?
The language worker
host.json
The output binding
The scale controller
How does the host communicate with an isolated or non-.NET language worker?
Over gRPC
Through shared SQL tables
By email
Over FTP
«
»

Comments & Discussions