Search code examples
azureazure-functionsazure-blob-storageazure-blob-trigger

blobtrigger not working when published on azure functions, but it working in local environment


My azure function not trigger after upload my file to corresponding storage account container, but this is working fine when I test my local with following settings.

I had to use local.setting.json like below

"Values": {
....
"AzureWebJobsStorage" : "UseDevelopmentStorage=true",
"AzureStorageMyUpload" : "<<My storage account access key, 
which is get copy from my container>>"
.....
}

I real time "AzureWebJobsStorage" value is another one storage account information

"AzureStorageMyUpload" : "DefaultEndpointsProtocol=https;AccountName=<<ACCOUNT_NAME>>;AccountKey=<<ACCOUNT_KEY>>;EndpointSuffix=core.windows.net"

and

"AzureStorageMyUpload" : "DefaultEndpointsProtocol=https;AccountName=<<ACCOUNT_NAME>>;AccountKey=<<ACCOUNT_KEY>>;BlobEndpoint=https://<<ACCOUNT_NAME>>.blob.core.windows.net/;TableEndpoint=https://<<ACCOUNT_NAME>>.table.core.windows.net/;QueueEndpoint=https://<<ACCOUNT_NAME>>.queue.core.windows.net/;FileEndpoint=https://<<ACCOUNT_NAME>>.file.core.windows.net/"

My azure function below

[FunctionName("UploadCSV")]
public static async Task Run([BlobTrigger("<<containerName>>/<<folderName>>/{name}.csv", 
Connection = "AzureStorageMyUpload")]
            Stream stream, string name, ILogger log){
              log.LogInformation("UploadCSV starts");
    }

Function

Runtime version: 1.0.12922.0 (~1)

When I was created new blob trigger from the azure portal itself, it is working fine for me. the same one is not working when I create from local with help of visual studio code 2019 in azure portal it's seems like "function.json".


Solution

  • This is working now, I just removed connection string name and replay to

    "AzureWebJobsStorage": "<<live storage account details>>"
    
    
    [FunctionName("UploadCSV")]
    public static async Task Run([BlobTrigger("<<containerName>>/<<folderName>>/{name}.csv", 
    Connection = "AzureWebJobsStorage")]
                Stream stream, string name, ILogger log){
                  log.LogInformation("UploadCSV starts");
        }