user1982231
user1982231

Reputation: 25

How to get the global setting in Host.json file of a Azure function

i have some settings in host.json file. I know that is globla settings for function app. I can get it on local but in production.

In local, i have this work
var maxDequeueCount=config.GetSection("extensions:queues:maxDequeueCount").Value;

Anyone tell me how to read setting from host.json file?

Thank you

var maxDequeueCount=config.GetSection("extensions:queues:maxDequeueCount").Value;

Upvotes: 1

Views: 2333

Answers (2)

Wouter
Wouter

Reputation: 2938

This works for me:

var config = builder.GetContext().Configuration;
string maxAutoRenewDuration = config.GetSection("AzureFunctionsJobHost:extensions:serviceBus:messageHandlerOptions:maxAutoRenewDuration").Value;

Upvotes: 1

DixitArora-MSFT
DixitArora-MSFT

Reputation: 1811

The host.json metadata file contains global configuration options that affect all functions for a function app.

Other function app configuration options are managed in your app settings.

Settings in the local.settings.json file are only used by Functions tools when running locally

Regarding your query : You could config it in your appsettings blade of the azure function

enter image description here

Upvotes: 0

Related Questions