I am trying to access content from the Blob Storage from an Azure function. I have the following:
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Blob;
public static async Task<HttpResponseMessage> Run(HttpRequest req, ILogger log)
{
string path = req.Query["path"];
string storageConnectionString = "...";
CloudStorageAccount blobAccount = CloudStorageAccount.Parse(storageConnectionString);
CloudBlobClient blobClient = blobAccount.CreateCloudBlobClient();
CloudBlobContainer blobContainer = blobClient.GetContainerReference("content");
CloudBlockBlob cloudBlockBlob = blobContainer.GetBlockBlobReference(path);*
return new HttpResponseMessage(HttpStatusCode.OK) {
Content = /* to do - content of blob */
};
}
However, I am struggling to tell the function to recognize Microsoft.WindowsAzure.Storage namespace:
2019-11-07T09:59:57.729 [Error] run.csx(7,17): error CS0234: The type or namespace name 'WindowsAzure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
I feel I am missing something major in my understanding of Azure Functions, as it should not be such a challenge to pull in namespaces/packages to work with Azure from within an Azure function.
Thanks a lot!