I'm trying to create an Azure Function (.NET core) to retrieve a SaS from a storage account and am struggling to understand why I cannot access the storage.
The function signature:
public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req,
[StorageAccount("StorageConnectionString")] StorageAccount storage,
ILogger log)
When running it, there's this error:
Error indexing method 'GetBlobSaS' Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'storage' to type StorageAccount. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
If I'm creating the storage account reference directly it works fine:
var storage = StorageAccount.NewFromConnectionString(System.Environment.GetEnvironmentVariable("StorageConnectionString"));
What am I misunderstanding or doing wrong?