Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use connectionstring in WebJob on Azure

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.

like image 899
Piotr Stapp Avatar asked May 21 '14 18:05

Piotr Stapp


1 Answers

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.

like image 188
Amit Apple Avatar answered Sep 28 '22 02:09

Amit Apple