0

I am trying to implement azure blob trigger for my ADLS2 storage

Here is the simple trigger

public class Function1
{
    [FunctionName("Function1")]
    public void Run([BlobTrigger("sample/my-directory/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, ILogger log)
    {
        log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
    }
}

But when I upload new files into the container sample/my-directory it is not triggering my blob trigger.

But again, As in the below screenshot, my connection string is valid. I am able to connect to the storage using the same connectionstring from StorageExplorer and also below dependencies shows its connecting fine.

Here is my local.settings.json file as well

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsDashboard": "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=xxx;EndpointSuffix=core.windows.net",
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=https;AccountName=myaccount;AccountKey=xxx;EndpointSuffix=core.windows.net",,
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"

  }
}

Please share your thoughts what did I missed or my approach is wrong?

enter image description here

Sandeep Thomas
  • 4,303
  • 14
  • 61
  • 132

1 Answers1

0

I can see that on your Connected Services the Azure Storage: aplledossdevuksstd 's Connection String name is replaced with Connection String value but need to provide just a sample connection string name. Its value is automatically will be stored in Secrets.json.

enter image description here

enter image description here

Alternatively, you can add your connection string in local.settings.json and add the connection string name in Function1.cs

local.settings.json

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "<YOUR CONNECTION STRING>",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

Function1.cs

using System;
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace FunctionApp3
{
    public class Function1
    {
        [FunctionName("Function1")]
        public void Run([BlobTrigger("samples/dir1/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, ILogger log)
        {
            log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
        }
    }
}

RESULTS:

enter image description here

SwethaKandikonda
  • 7,513
  • 2
  • 4
  • 18