I am using Azure Queue Trigger v4 to get it triggered through managed identity having Storage Queue Data Contributor Role, but when new message is added in Queue, this azure function does not get triggered. I checked the application insight but there is no error.
[FunctionName("TestSyncFunction")]
public async Task Run(
[QueueTrigger("file-queue", Connection = "QueueConection")] QueueMessage queueMessage,
ILogger log)
{
log.LogInformation($"TestSyncFunction function executed at: {DateTime.Now}");
}
//My local.settings.json looks like this: "QueueConection__queueServiceUri": "https://xyz.queue.core.windows.net/", "QueueConection__credential": "managedidentity"
Also, I referred to 2 existing links but there is no help at all.
I have reproduced the issue and got the expected output using following steps-
Primarily I updated the package to Microsoft.Azure.WebJobs.Extensions.Storage.Queues" Version="5.1.3
and then added the following roles to my function app in storage account as stated in MS Docs.
Once you added these roles, then you will be able to see them in your function app as below
Then I added the below role to my account in the storage account-
I have tested my function locally as well as in Portal and it worked as expected in both cases.
Code:
public class Function1
{
[FunctionName("TestSyncFunction")]
public void Run([QueueTrigger("sample-queue", Connection = "QueueConection")]string myQueueItem, ILogger log)
{
log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
}
}
local.setting
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"QueueConection__queueServiceUri": "https://<storageaccount name>.queue.core.windows.net/"
}
}
Local Output:
Portal:
App Settings
Application Insight: