Why do I need to configure connection strings for WebJobs in Azure Management Portal rather than in the App.config of my WebJob?

Tyler Pohl picture Tyler Pohl · Jan 21, 2015 · Viewed 10.1k times · Source

I created a scheduled Azure WebJob by right clicking on my WebApp project and adding a New Azure web project. I set the the AzureWebJobsDashboard and AzureWebJobsStorage connection strings in the App.config of the WebJob project. I left the default code in the .cs files alone for now. Next, I published from Visual Studio (2013 Update 4 by the way) to an Azure website. It created the WebJob and I can run it from the Azure Management site or Visual Studio and it is successful. I can see the output logs where I expect them to be. However, the Azure WebJob Details page shows the following warnings/errors:

Make sure that you are setting a connection string named AzureWebJobsDashboard in your Microsoft Azure Website configuration by using the following format DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY pointing to the Microsoft Azure Storage account where the Microsoft Azure WebJobs Runtime logs are stored.

The configuration is not properly set for the Microsoft Azure WebJobs Dashboard. In your Microsoft Azure Website configuration you must set a connection string named AzureWebJobsDashboard by using the following format DefaultEndpointsProtocol=https;AccountName=NAME;AccountKey=KEY pointing to the Microsoft Azure Storage account where the Microsoft Azure WebJobs Runtime logs are stored.

It also provides a link that was to http://azure.microsoft.com/blog/2013/07/17/windows-azure-web-sites-how-application-strings-and-connection-strings-work/ which doesn't explain why I am getting the error message.

Now, to get this warning/error to go away, I go add the same AzureWebJobsDashboard connection string in the configure page in the Azure Management site.

So, I'm trying to figure out if I did something wrong or if this is just a kink in the WebJobs that Microsoft hasn't fixed yet. I would really like to be able to have this in the App.config rather than have to remember to set it up in each website we spawn up for different environments.

Thank you very much for your time and help.

Answer

Victor Hurdugaci picture Victor Hurdugaci · Jan 21, 2015

The dashboard doesn't have access to your web job's app.config file and even if it did, you might have multiple webjobs so it wouldn't know which connection string to pick. That is why you need to set the connection string in the portal.

However, you don't have to set it in app.config for the web job if you set them in the portal. The WebJobs SDK knows how to read them from there.