1
votes

I have function app which connect to blob , read file content and post content to API. The function works perfect on debug from Visual Studio . The problem I am having is does not work from Azure when deployed . The error I ma getting is:

Exception while executing function: MyFunctionManager

Problem Id:System.ArgumentNullException at MYFUNCTION.FA.FileManager.BlobContainerManager.GetCloudBlobContainer

It seems cannot connect and find the blob storage. In the code I am getting the container using connection string set in the local.settings.json:

     public static CloudBlobContainer GetCloudBlobContainer(string blobContainer)
    {
        CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
            App.Settings.AzureFileStorageConnectionString);
        CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
        CloudBlobContainer container = blobClient.GetContainerReference(blobContainer);
        container.CreateIfNotExistsAsync();
        return container;
    }

Any help appreciated

Thanks

1
The error message said your blobContainer parameter is null. How do you get the container name ?Thomas

1 Answers

2
votes

The local.settings.json file is just for local development.

When running on Azure, make sure you have an Application Setting with key AzureFileStorageConnectionString and value to your storage account's connection string.

And you would have to do the same for the container name too since you mentioned that you are getting it from Application Settings.