Within Azure I’ve developed a function (App service) which is triggered when a new csv files is placed in a specific storage account. The function has been developed in Azure and functions without problems each time a new csv file is uploaded. However with CI/CD in mind I’ve decided to move my development process from Azure to Visual Studio (2017).
The code runs without any problems locally, but as soon as I publish the code to Azure (through VSTS) the challenge begins. It seems as if the trigger doesn’t get activated when new csv files are being uploaded to the storage account. Incidentally the function did trigger, but I have not been able to pinpoint why this is, or recreate it.
In order to make the problem more understandable I’ve reduced my code to just the Blobtrigger and some logging. Also I removed the build in VSTS and directly published my build through Visual Studio 2017, but with similar results. The code works fine locally, but after publishing it the function doesn’t get triggered (or does so very incidentally).
The code I used:
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace TestApp
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([BlobTrigger("csv-files-in/{name}.csv", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, TraceWriter log)
{
log.Info($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
}
}
}
“AzureWebJobsStorage” refers to a local.settings.json where the endpoint of the Blobstorage is defined. This setting is automatically deployed to Azure, but even if I set this connection manually the function doesn’t get triggered. After many attempts of solving this on my own I’ve decided to ask the smart people on this website for advice. Is this a bug or am I missing something? What can I do to ensure that my function does (reliably) get triggered after publishing this towards Azure? Thanks in advance.
AzureWebJobsStorage
and also all your settings have be set in the appsettings blade of the function app – ThomasAzureWebJobsStorage
are also set in my app settings. I've also tried placing the 'AzureWebJobsStorage
as a connection string instead of an application setting, but without any succes – JustWondering