Discover issues with Azure Functions and App Service using Application Insights

Discover issues with Azure Functions and App Service using Application Insights

In recent years, I have built and operated distributed cloud systems. With these systems comes various challenges. A key thing I've learned  is to keep a close eye on metrics and insights, to learn how our applications are behaving at scale. This post will be about how to make use of Azure Application Insights to learn about performance and execution issues in Azure Functions, and ultimately in Azure App Services. We will take a look at these things: Use cases. Some favorites from my professional experiences.Favorite KQL (Kusto Query Language) queries. Querying the telemetry and logs for insightful data.…

Read More

Best Practices for building and designing Azure Functions

Best Practices for building and designing Azure Functions

The years fly by, and we continue to evolve how we design and architect our systems. As we learn more, and technology evolves, so does our processes and design considerations. In this post I want to make notes of a few best practices I've adopted and keep at the top of mind when I engage in new projects that require reliable serverless executions at scale. There are a ton of other things I would want to add to this post as well, but I've chosen the things I consider to be "a-ha" moments for myself throughout my years of building…

Read More

Re-use service instances by Implementing Dependency Injection in Azure Functions

Re-use service instances by Implementing Dependency Injection in Azure Functions

Imagine you have a Function App that has multiple Functions deployed. It's a common scenario, and depending on how you've built the architecture for the solution, it can come in handy to use Dependency Injection to instantiate a service once when the Function App (host) starts up, and re-use that object across all executions of your Functions inside this Function App. To paint a picture of what this means, I can refer to one of my spare-time project scenarios. I have a Function App on a premium tier with 8 Functions that are a mix between Timer Triggers and Queue…

Read More

Issues with "Cannot bind parameter 'log' to type ILogger." after upgrading Azure Functions to v3

Issues with "Cannot bind parameter 'log' to type ILogger." after upgrading Azure Functions to v3

I have a lot of Azure Functions. Most of them are running on v2 with support for .NET Core 2.2 and netstandard2.0. During the upgrade process of my projects, I stumbled onto this several times across different projects: Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type ILogger. The full message: [2019-12-17 8:10:32 PM] Error indexing method 'ControlApp' [2019-12-17 8:10:32 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'ControlApp'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type ILogger. Make sure the parameter Type is supported by the binding. If you're using…

Read More

Azure Functions and secure Configuration with built-in integration to Azure Key Vault

Azure Functions and secure Configuration with built-in integration to Azure Key Vault

Azure Functions are usually tied to an Azure Storage Account by using App Settings. Unfortunately, when launching a new Function App project in Visual Studio, or watching demos and examples online, the connection string usually is in App Settings in plain text. In this post I'm sharing a quick tip on how to protect sensitive configuration values in App Settings by using Secrets from a Key Vault, and you can even reference the default Storage Account connection string this way, completely avoiding any type of sensitive data in App Settings, from scratch. Microsoft have some good documentation (links in the…

Read More

Getting the instance id of a running Azure Function with ExecutionContext.InvocationId

Getting the instance id of a running Azure Function with ExecutionContext.InvocationId

Recently I had a discussion about Azure Functions, the pros and cons, and running multiple instances of batch processing simultaneously. One of the immediate questions that came up in that discussion was; In the built-in logs you see in the streaming log service or in the log console, how do you know which message comes from what invocation? Great question, let's dig into that! Get the Invocation Id of an instance of a Azure Function When a Function runs, it gets a new unique identifier by default. You can see this in the invocation log: 2016-12-01T22:34:34.605 Function…

Read More