Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 610
Tyler Pohl Avatar asked Jan 21 '15 21:01

Tyler Pohl


People also ask

What is connection string in Azure App Service?

Just as all Azure Web Apps need configuration values, most applications also need to have database Connection String values configured. With Azure Web Apps the Connection Strings are stored/retrieved in a very similar fashion as Azure Web App Application Settings.

Which Azure websites feature should you enable for continuously running WebJobs?

If you set the web app that hosts your job to run continuously, run on a schedule, or use event-driven triggers, enable the Always on setting on your web app's Azure Configuration page. The Always on setting helps to make sure that these kinds of WebJobs run reliably.

How do I get a connection string from Azure App Service?

In the Azure portal, search for and select App Services, and then select your app. In the app's left menu, select Configuration > Application settings. By default, values for connection strings are hidden in the portal for security. To see a hidden value of a connection string, click its Value field.

What is the use of WebJobs in Azure?

Scheduling tasks to run at specific times or intervals, triggering jobs to run based on certain events, etc are common scenarios that we encounter while developing applications. In this article, we are going to learn about Azure WebJobs which provides an excellent way of accomplishing this in a cloud environment.


1 Answers

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.

like image 141
Victor Hurdugaci Avatar answered Oct 05 '22 22:10

Victor Hurdugaci