Application testing
.NET Core Azure Azure App Services Azure Blob Azure Function Azure Storage Blob Trigger C# Kudu PaaS Visual Studio

How to Test Azure Blob Trigger Functions

Welcome to today’s post.

Today I will show how to test an Azure Blob Trigger function.

In a previous post I showed how to create an Azure Blob Trigger Function.

An Azure trigger function runs continuously in an idle state, being triggered once a specific condition is met.

An Azure blob trigger function is triggered when a blob is uploaded into the function’s Azure storage.

An upload into the Azure storage can be completed using either a cloud-hosted .NET application or directly from the Azure portal.

The most typical usage for a blob trigger is to trigger an event when an image is uploaded into our site, then within the event handler we action a process such as the next stage of a workflow or execute a notification email to the end user.

Before you can test an Azure Blob Trigger function, you will need to ensure the function app is running:

Next, you will need to upload a file to the Azure Storage blob container location that is referenced from the bob trigger function.

To determine the location that we wish to upload the blob within Azure storage, you will need to view to trigger source function definition and locate the path attribute as shown:

We next uploaded our file using the blob upload dialog.

Next, we return to the function app overview screen and select the Monitor option:

The status of the trigger is shown. If we have been successful uploading the file, you will see a green tick:

We drill down into this successful log entry by clicking on it.

The messages relevant to the blob trigger function execution are as shown:

An alternative way of verifying the result of an Azure Blob Trigger is to use the Kudu services console to check the logs.

Opening the latest log file will show similar messages that are to the portal invocation details:

The log will display any logs we have output from within our trigger function C# handler, which is useful for diagnostic and troubleshooting purposes.

That’s all for today’s post.

I hope you have found this post useful and informative.

Social media & sharing icons powered by UltimatelySocial