how to implement an azure function using visual code on a mac that communicates with a queue?
All the examples I come across (shown below) seem to show visual studio together with nuget package manager. What's the equivalent to download the necessary package in visual code to communicate with queues? I've downloaded the following for visual code but I get an error
https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestorage
Code sample
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Company.Function
{
public static class HttpTriggerCSharp
{
[FunctionName("QueueTriggerMetadata")]
public static void Run([QueueTrigger("101functionsqueue", Connection = "AzureWebJobsStorage")]string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
}
}
}
error message when deploying
The type or namespace name 'QueueTriggerAttribute' could not be found (are you missing a using directive or an assembly reference?)
error message received after updating the csproj file
Missing value for AzureWebJobsStorage in local.settings.json. This is required for all triggers other than httptrigger, kafkatrigger. You can run 'func azure functionapp fetch-app-settings ' or specify a connection string in local.settings.json.
According to my test, my function was triggered successfully after install the extension "Azure Storage for Visual Studio Code". So could you please recreate the function again after install the extension or click the "extension" button in your VS code, check if you have installed the extension successfully and check if it is enable(shown as screenshot below)
Apart from this, you also need to check if the extension exists in your "csproj" file. In my test, if I remove
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.4" />
from the "csporj" file, it will show the error message which is same to yours'.
Below I post my azure function for your reference, I create the function with the default setting after install the extension and it works fine.