In all of the manuals about how to get the Storage connection for azure web jobs it is said to have those two variables AzureWebJobsDashboard, AzureWebJobsStorage in the connection strings. It works properly for ordinary .net, but it's quite an issue with DNX, since it seems that ConfigurationManager is not available there. So I have added the two strings to the ConnectionStrings in the portal, but I cannot find a good way how the Web Job would read them automatically. I ended up reading them myself from the Environment variables this way:
string dahsboard = Environment.GetEnvironmentVariable("CUSTOMCONNSTR_AzureWebJobsDashboard");
string storage = Environment.GetEnvironmentVariable("CUSTOMCONNSTR_AzureWebJobsStorage");
var configuration = new JobHostConfiguration();
configuration.DashboardConnectionString = dahsboard;
configuration.StorageConnectionString = storage;
JobHost host = new JobHost(configuration);
host.RunAndBlock();
But is this the only way now or there is some way that will let Web Job find this settings on it's own like ordinary .Net will?
Your best best is to set it as an App Setting instead of a connection string in the Azure Portal. This way, you will be able to refer to it by simple name (e.g.
AzureWebJobsDashboard
) with no funny prefix. Generally, you should avoid building assumptions on prefixes likeCUSTOMCONNSTR_
.