App settings makes it easier for you to over write it in your build process within VSTS or within Azure as it's a simple over write, however with connection strings it gets a bit more complex. Seperate connection string files are also good, but if you are looking for a secure storage location than Azure Key Vault is a good option.
– ObiEffNov 7 '17 at 15:11

Using KeyVault moves the question to, "when in dev", but there you could still ask the same question.
– Michiel CornilleNov 7 '17 at 15:19

Im not so much interested in why app settings over connection strings, I'm interested in what is the consensus "imposed" by MS, .. but with the downvotes Im afraid this will get buried soon, thanks anyway @ObiEff
– Michiel CornilleNov 7 '17 at 15:23

1

Apologies, I thought it was more of a when would you use what. AFAIK there isn't really a convention, different methods serve different purposes. Some of the examples Microsoft provide use the Connection Strings file,some use app settings. With regards to KeyVault there are two approaches to use, you could have multiple keyVaultInstances, one for each environment. Another solution is to have a wrapper around the KeyVaultClient that appends the environment name onto the key so dbConnectionString -> dbConnectionStringDev. The environment name would be stored in the appSettings.
– ObiEffNov 8 '17 at 11:09

1 Answer
1

When creating a new WebJob project, the AzureWebJobsStorage connection string is added to App.config > configuration > connectionStrings

When your creating the Azure WebJob project, it would reference the related WebJob libraries (Microsoft.Azure.WebJobs, Microsoft.Azure.WebJobs.Core). You need to specify a storage account for the WebJob SDK to log traces and metric data. And the connection string need to be specified under the connectionStrings section of your config file, otherwise you would retrieve the following error:

Microsoft Azure WebJobs SDK Dashboard connection string is missing or empty. The Microsoft Azure Storage account connection string can be set in the following ways:

Set the connection string named 'AzureWebJobsDashboard' in the connectionStrings section of the .config file in the following format

Set the environment variable named 'AzureWebJobsDashboard'

Set corresponding property of JobHostConfiguration

Per my understanding, the Azure WebJob SDK only support reading the storage connection string from the above approaches. You could also set the connection string under the appSettings section, at this point you need to specify the related properties when constructing the JobHostConfiguration as follows:

What is the recommended place? Is connectionStrings only for database connection strings?

Per my understanding, when you are using the 3rd party libraries, you need to follow it's instruction for configuration. While you writing your code, you could define the connection string as you wish and read them in the corresponding way.