Following the documentation below I trying to create an azure function which adds a message to a queue.
The code gets triggered and executes with out an error, but I could not see any message in the Azure Storage Explorer Queue.
I added Azurite Storage account to my local Storage Explorer. But the queue does not get created and the message is not getting added.
AzureWebJobsStorage is set to "UseDevelopmentStorage=true".
How do I test this locally in the storage explorer? What are the steps and what all do I need?
I tried to reproduce the issue by following steps:
Microsoft.Azure.WebJobs.Extensions.Storage
through Nuget Package Solution to the Project.public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, [Queue("outqueue"), StorageAccount("AzureWebJobsStorage")] ICollector<string> msg, ILogger log)
Added the code which writes the passed parameter in the function URL to the output queue (before parsing the response message code):
if (!string.IsNullOrEmpty(name))
{
// Add a message to the output collection.
msg.Add(string.Format("Name passed to the function: {0}", name));
}
Now the full code looks is:
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet"
}
}
Run the function locally and copy the function URL that comes in the console to the browser along with parameters like:
http://localhost:7071/api/Function1?name=HariKrishna
Then it should be displayed in the browser as Hello, HariKrishna. This HTTP triggered function executed successfully.
Go to the Storage Explorer > Expand Queues and refresh it (right-click on queues and click refresh) to see the queue created by functions runtime while a function is running and refresh the output queue also to see the messages as you can the console output, browser output and Queue messages in below screenshot: