2
votes

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?

1
Could you add your connection string to the question (obfuscate the secrets)?Mikhail Shilkov
@Mikhail added connection stringAmry
@Amry Go to the azure portal storage/Settings/Access_keys to take a Connection String. The format is DefaultEndpointsProtocol=https;AccountName=<youraccountname>;AccountKey=<youraccountkey>;EndpointSuffix=core.windows.netRoman Kiss
@RomanKiss FYI, the connection string I used is working fine if I were to do new CloudStorageAccount(thatConnectionString). But I guess now that it has come to this point, I might as well try the account key format.Amry

1 Answers

1
votes

Go to the azure portal storage/Settings/Access_keys to take a Connection String.

The format is

DefaultEndpointsProtocol=https;AccountName=<youraccountname>‌​;AccountKey=<youracc‌​ountkey>;EndpointSuf‌​fix=core.windows.net