Tauqir
Tauqir

Reputation: 491

Do Azure WebApps and WebJobs share configuration

I have a Web App and a Web job both deployed in Azure App Service. In my WebJob project I have a appsettings.json file with some configuration items. There is also a appsettings.env.json Then the secrets are read from KeyVault. All this is using dot net core ConfigurationBuilder class.

I know that I can override any of the settings in appsettings.json using Azure App Service Configuration that translates into environment variables.

My question is, do I need to have appsettings.json and appsettigs.env.json files for the WebJob project as well or will these configurations be available to webjob from WebApp. If the App Service Coniguration is shared by the WebApp and WebJob, can it be expected that the appsettings will also be shared.

Thanks

Upvotes: 3

Views: 900

Answers (2)

Tauqir
Tauqir

Reputation: 491

An app service and the webjobs hosted in the same service are independent projects with their own configuration files. The Environment variables are shared by both.

Upvotes: 2

Ryan Hill
Ryan Hill

Reputation: 1942

You don't need appsettings.[env].json. Its primary purpose allows you to have different settings for different environments. Your configured app settings should work the same across your app service and webjob.

Upvotes: 1

Related Questions