My simplified code sample
I have the following simplified Azure Function code built in Visual Studio 2017:
public static class FunctionApp
{
[FunctionName("MyFunction")]
public static void Run(
[TimerTrigger("0 */5 * * * *")] TimerInfo myTimer,
[StorageAccount("ConnectionString")] CloudStorageAccount storage)
{}
}
With the following connection string
I have already added a key "AzureWebJobsConnectionString" to the file local.settings.json for development test purpose. However I'm getting the following error message when debugging:
Error indexing method 'FunctionApp.Run' Microsoft.Azure.WebJobs.Host: Error indexing method 'FunctionApp.Run'. Microsoft.Azure.WebJobs.Host: Invalid storage account ''. Please make sure your credentials are correct.
The added connection string form is as following:
BlobEndpoint=https://******.blob.core.windows.net;SharedAccessSignature=sv=2017-04-17&ss=b&srt=sco&sp=dl&se=2099-12-31T00:00:00Z&st=2017-10-22T00:00:00Z&spr=https&sig=******
And also tested in Azure
Then I configured a connection string named "AzureWebJobsConnectionString" in the Azure Function Portal's Application Settings to test it in Azure, but no success story.
But still without success :(
How do I get the CloudStorageAccount to properly bind to the Azure Function?
new CloudStorageAccount(thatConnectionString)
. But I guess now that it has come to this point, I might as well try the account key format. – Amry