Use connectionstring in WebJob on Azure

Piotr Stapp picture Piotr Stapp · May 21, 2014 · Viewed 10.9k times · Source

Is there an easy way to share connection string between website and WebJob on Azure? The only way I found already is to read web.config from console application, but it doesn't look good for me.

Answer

Amit Apple picture Amit Apple · May 21, 2014

The Azure website and WebJob are sharing the application settings/connection strings set on the Azure portal. So assuming you're using a .NET console application as a WebJob, just use ConfigurationManager to get your connection string (to help test it, just have your app.config have the same connection string key).

If you're not using .NET console application, the connection strings are in the environment so you can just query for them.