
Application Insights is a monitoring and analytics service that helps you understand how your Azure Functions are performing.
You can use Application Insights to monitor and debug your isolated Azure Functions, which are a type of Azure Function that runs in a separate process.
The Isolated process provides a more secure and scalable environment for your Azure Functions, but it also introduces some complexities when it comes to monitoring and debugging.
Azure Functions Execution Mode
Azure Functions have two main execution modes: In-process and Isolated-process. Initially, .NET Azure Functions only supported In-process mode, where your function code runs in the same .NET process as the host.
In-process mode had shortcomings, such as the inability to create/use your Host instance to register your own Middleware, Logger, etc. It also had performance benefits like faster cold start times.
Microsoft introduced Isolated-process mode for running your code in Azure Functions, starting with .NET 5. This mode decouples your function code from the Azure Functions runtime, allowing you to utilize any supported version of .NET.
Isolated mode provides full control over how you configure & run your code inside Azure Functions, and allows you to utilize features such as implementing custom Middleware, Logging, etc.
Here are the main benefits of Isolated-process mode:
- Full control over how you configure & run your code inside Azure Functions
- Ability to utilize features such as implementing custom Middleware, Logging, etc.
- Encountering fewer conflicts between the code assemblies & the assemblies used by the host process.
Isolated Execution
In .NET 5, Microsoft introduced a new execution mode for Azure Functions, known as Isolated-process or Out-of-process mode.
This mode decouples your function code from the Azure Functions runtime, allowing you to use any supported version of .NET, even if it's different from the runtime version.
Isolated-mode execution offers numerous advantages over In-process execution mode, including full control over how you configure and run your code inside Azure Functions.
You can utilize features such as implementing custom Middleware, Logging, and encounter fewer conflicts between code assemblies and the assemblies used by the host process.
The Isolated-process Function Apps are indeed the future of Azure Functions, as per Microsoft's roadmap, and will be the only choice from .NET 7 onwards.
To set up an Azure Functions project to run in Isolated process mode, select the Azure Functions project template and choose the “.NET 6.0 Isolated (LTS)” type in the dropdown.
The critical point to notice in an isolated functions project is that it contains a Program.cs file, which provides direct access to the Host instance, giving you complete control over setting any code configurations and dependencies.
There is no separate Startup class available or required in an isolated functions project.
Note that the FUNCTIONS_WORKER_RUNTIME application setting in the local.settings.json file is set to “dotnet-isolated” for an isolated function, whereas it's set to “dotnet” for an in-process Azure Function.
Durable Execution
Azure Functions supports durable execution, which allows functions to run indefinitely until they complete their task, or until they are cancelled.
This mode is particularly useful for tasks that require long-running operations, such as processing large datasets or performing complex computations.
Durable functions can be triggered by HTTP requests, timers, or other events, and can be written in languages such as C#, JavaScript, or Python.
They can also be used to implement workflows that involve multiple steps, such as data processing and validation.
Durable execution provides a range of benefits, including improved reliability, scalability, and maintainability.
Functions can be scaled up or down as needed, and can be easily monitored and debugged.
This flexibility makes durable execution a powerful tool for building complex, scalable applications.
Azure Function Issues
Azure Function Issues can be frustrating, but understanding the common problems can help you troubleshoot more efficiently.
One of the most common issues is the "Azure Functions host is not running" error, which can occur if the function app is not enabled or if there's a configuration issue.
To resolve this, make sure the function app is running and the configuration is correct, as described in the "Azure Function App Settings" section. This will ensure that the function is properly configured and can run without errors.
Another issue is the "Timeout" error, which can occur if the function is taking too long to execute. This is often due to a large dataset being processed or a complex algorithm being used.
Known Issues

Simultaneous requests in HTTP-based functions can cause problems, resulting in a series of log statements being sent to our log looking like this: Log messages stored twice.
This issue is still relevant for Isolated functions, and it's a bit annoying that it's not prioritized higher by Microsoft.
The problem seems to originate in auto-generated code, and it's been explained in detail here: https://learn.microsoft.com/en-us/answers/questions/1609713/azure-function-fails-with-functioninvocationexcept.
Another issue I've experienced is with the Service Bus trigger and CancellationToken, which can cause an error when converting input parameters.
Fortunately, this issue seems to have been resolved already, so you might not encounter it if you're using the latest fixes.
Troubleshooting
Troubleshooting Azure Function Issues can be a challenge, but don't worry, we've got you covered.
First, make sure you're checking the Azure Function logs for any error messages. This can be done by clicking on the "Monitor" tab in the Azure portal.
Azure Function logs can be tricky to read, but looking for the "Exception" section can give you a clear indication of what went wrong.
The most common error message you'll see is the "Timeout" error, which occurs when the function takes too long to execute. This can be caused by a long-running operation or a poorly optimized function.
If you're experiencing issues with your Azure Function, check the function's configuration to ensure that the "Timeout" setting is not too low.
A high memory usage can also cause Azure Function issues, as it can lead to a "Memory Limit Exceeded" error. This can be caused by a large input or a poorly optimized function.
To troubleshoot memory issues, check the function's memory usage by clicking on the "Monitor" tab in the Azure portal.
Azure Function issues can also be caused by a misconfigured environment variable, so be sure to double-check your environment variable settings.
Sources
- https://demiliani.com/2023/06/27/azure-functions-how-to-debug-remotely-in-production/
- https://blog.elmah.io/lessons-learned-after-migrating-azure-functions-to-isolated-functions-on-net-8/
- https://www.cloudfronts.com/azure/azure-function/use-of-environment-variable-inside-azure-function-in-c/
- https://www.ais.com/how-to-automate-scheduled-tasks-using-isolated-mode-azure-functions/
- https://www.infoq.com/news/2022/10/azure-functions-isolated-v4/
Featured Images: pexels.com