Java / Azure Functions Interview questions
Last updated
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
a managed relational database engine
a virtual network security appliance
a serverless, event-driven compute service
a container image registry
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
Up to three
Unlimited, as long as they share a name
None, because bindings start functions
Exactly one
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
Output binding
Input binding
Trigger
Host binding
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
Consumption plan
Dedicated (App Service) plan
Flex Consumption plan
Container Apps plan
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
Their trigger types
Their individual timeout values only
Hosting plan, runtime version, and app settings
Their function keys exclusively
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
Blob trigger
Event Grid trigger
Cosmos DB trigger
Timer trigger
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
HttpTrigger
QueueTrigger
FunctionName only
RouteBinding
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
Five
Six
Seven
Four
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
Only by converting it to Java
By using the Timer trigger template
Through a custom handler
It is impossible on any plan
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
local.settings.json
function.json of each function
The trigger attribute only
host.json
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
No, it is for local use only
Yes, it replaces host.json
Yes, but only for Python apps
Only when Always On is enabled
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
The scaling limits of the hosting plan
The trigger and bindings of a function
The Application Insights sampling rate
The deployment pipeline stages
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
Anonymous
Function
Admin
User
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.
func initcreates a new project.func newadds a function from a template.func startruns the host locally.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
func init
func publish --local
func new
func start
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
Event Hubs checkpoints and timer locks
Your application source code
Entra ID user passwords
Azure Monitor dashboards
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
Activity function
Orchestrator function
Timer function
Client binding
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 publishfor quick manual deploys. - Zip deploy / run from package: upload a zip and set
WEBSITE_RUN_FROM_PACKAGE=1so 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
AzureWebJobsStorage
FUNCTIONS_EXTENSION_VERSION only
WEBSITE_RUN_FROM_PACKAGE
WEBSITE_LOAD_USER_PROFILE
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
requestsandtracestables. - 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
AzureWebJobsDashboard only
WEBSITE_TIME_ZONE
FUNCTIONS_WORKER_RUNTIME
APPLICATIONINSIGHTS_CONNECTION_STRING
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
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
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
Reserved vCPU hours per month
Executions and GB-seconds of resource use
The number of function apps in a subscription
Storage account transactions only
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
Consumption
Neither of them
Premium
Both, with no limits
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
Windows only
Both Windows and Linux
macOS
Linux
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
Isolated worker
In-process
Both equally
Neither
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
The Application Insights agent
The scale controller
The Azure Resource Manager template
The function.json file
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:
- Use always-ready instances (Flex Consumption) or pre-warmed instances (Premium).
- Deploy with
WEBSITE_RUN_FROM_PACKAGEso file loading is fast. - Trim dependencies and avoid heavy work in startup code.
- Prefer lighter runtimes where latency matters, and reuse clients instead of creating them on each call.
- As a last resort, use a timer ping, though it is no substitute for a plan that has warm capacity.
Take quiz
Deployment slots on Consumption
A larger storage account
Always-ready or pre-warmed instances
Disabling Application Insights
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
Azure Functions
Azure Storage
Azure Policy
Logic Apps
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 WebJobs SDK
Azure Kubernetes Service
Logic Apps runtime
Azure Batch
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
In function.json
In Program.cs through ConfigureServices
In local.settings.json
In the HttpTrigger attribute
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
1
10
5
100
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
It is deleted immediately
It is moved to a blob container
It is completed anyway
It is abandoned and retried
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
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
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
Polling the container on a timer
Event Grid push events
Reading blob metadata daily
Checking host.json
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
Timer trigger
Event Hubs trigger
HTTP trigger
Cosmos DB trigger
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
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
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(usecontext.CurrentUtcDateTime)Guid.NewGuid()(usecontext.NewGuid())- Random numbers, environment reads that can change, and direct network or file I/O
Task.Delay(usecontext.CreateTimer)
Put anything non-deterministic inside an activity function, which runs once and has its result recorded.
Take quiz
context.CurrentUtcDateTime
DateTime.Now
Stopwatch.GetTimestamp()
Environment.TickCount
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.
- The orchestrator schedules an activity and saves that fact to the history table.
- The activity runs, and its result is written back as a new history event.
- The orchestrator is triggered again and replays from the start, using history to return stored results instead of re-running activities.
- 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
Blocks the thread until the activity ends
Saves state and unloads until the result returns
Deletes its history
Restarts the host
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
Function chaining
Aggregator
Async HTTP API
Fan-in only
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
Task.Delay
Thread.Sleep
Task.Run
Task.WhenAll
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
Serially, one at a time
In parallel across all instances
Only on Sundays
Only when the host restarts
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:
- Built-in authentication (Easy Auth) with Microsoft Entra ID, so callers present a valid token.
- Azure API Management in front, validating JWTs, applying rate limits, and hiding the function URL.
- Network restrictions: access restrictions or private endpoints so only trusted callers reach the app.
- HTTPS only with a minimum TLS version and a tight CORS allow-list.
- 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
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
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 |
- Enable the identity on the function app.
- Assign it an Azure RBAC role on the target, for example Storage Blob Data Contributor.
- 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
System-assigned
Anonymous
User-assigned
Admin
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
Premium
Flex Consumption
Dedicated
Consumption
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
5 minutes
30 minutes
230 seconds
1 hour
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
Because functions never scale out
Triggers can deliver the same message more than once
Because HTTP triggers reject duplicates
Because host.json forbids retries
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.
- Reuse connections: share
HttpClient, database, and SDK clients through DI instead of creating them per invocation. - Be async end to end: blocking calls tie up worker threads and limit throughput.
- Batch where possible: process Event Hubs and Service Bus messages in batches rather than one at a time.
- Keep functions short: split long work using queues or Durable Functions.
- Tune concurrency in
host.json, such asbatchSizeormaxConcurrentCalls. - Choose the right plan: Premium or Flex always-ready instances for latency-sensitive paths.
- Trim package size and use run from package for faster starts.
- 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
To increase the function timeout
To skip authentication
To avoid socket exhaustion and connection setup cost
To disable logging
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.
- Check the function is enabled. An app setting named
AzureWebJobs.<FunctionName>.Disabled=trueturns it off. - Check host health. Look in Application Insights or the Log stream for startup errors, bad
host.json, or runtime mismatches. - Validate
AzureWebJobsStorage. A bad key or firewall block stops most triggers. - Match connection names. The
Connectionproperty must name an existing app setting, and queue or container names must be exact. - Sync triggers. After some ARM or container deployments, run Sync triggers so the scale controller knows about them.
- Check networking. A private event source needs VNet integration and DNS that resolves.
- 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
FUNCTIONS_DISABLED_LIST
WEBSITE_SKIP_TRIGGER
AzureWebJobsDisabled
AzureWebJobs.<FunctionName>.Disabled
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
AKS
Azure Functions Consumption
Logic Apps
Azure Event Grid
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>.Disabledto prevent double processing.
HTTP functions are the easiest to swap. For queue-based apps, plan the cutover carefully.
Take quiz
It moves to production on every swap
It stays with the slot during a swap
It disables the slot
It encrypts the swap
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
batchSize on Queue only
functionTimeout
maxConcurrentCalls
FUNCTIONS_EXTENSION_VERSION
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.
- The scale controller monitors triggers (queue depth, partition lag, request rate) and tells the platform to add or remove instances.
- On each instance, the host starts, reads
host.jsonand the function metadata, and starts a listener for each trigger. - 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).
- 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"]