0

Got a function working locally, triggered when a file is dropped and now deploying to azure.

Function signature looks like this. Notice the binding expression.
This expression is attempting to pull a value from appsettings called "MyFolderPath"
Locally this works as expected. The path is container/folder_name
The setting is available in azure under Environment variables.
However, when I drop a new file in that path, the function is not triggered or invoked.
What can I check?

public async Task Run([BlobTrigger("%MyFolderPath%/{name}",Connection = "FuncStorage", Stream stream, string name)

1 Answer 1

1

Initially I was getting same issue. but, after adding the storage connection string in function app environment variables working as expected.

  • while adding the connection string in environment variable name and value must be same in portal and local.
  • After adding the connection string need to redeploy the function.

enter image description here

I have created blob trigger function with run time stack .NET 8.0. The function got triggered when i uploaded blobs in container.

Function code:

public class Function1
{
    private readonly ILogger<Function1> _logger;

    public Function1(ILogger<Function1> logger)
    {
        _logger = logger;
    }

    [Function(nameof(Function1))]
    public async Task Run([BlobTrigger("hello32/{name}", Connection = "Connection23")] Stream stream, string name)
    {
        using var blobStreamReader = new StreamReader(stream);
        var content = await blobStreamReader.ReadToEndAsync();
        _logger.LogInformation($"C# Blob trigger function Processed blob\n Name: {name} \n Data: {content}");
    }
}

local.settings.json:

{
    "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
    "Connection23": "your-storage conn-string"
  }
}

enter image description here

I have published the function into azure portal successfully. check below:

enter image description here

When I uploaded the blobs in container the function got triggered in portal as well. check the below traces:

enter image description here

Below are uploaded blobs in storage container.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. I thought I had checked over the local settings vs the deployed settings/ environment vars, but sure enough there was a difference. Once corrected, things started working as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.