Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I override the host settings of my azure function locally?

Say you have a host.json file like this:

{
  "version": "2.0",
  "extensions": {
    "serviceBus": {
      "messageHandlerOptions": {
        "maxConcurrentCalls": 16,
        "maxAutoRenewDuration": "00:05:00"
      }
    }
  }
}

But you wish to override the setting locally in local.settings.json or in the settings for a given environment on Azure. Is it possible, and how do you do it?

like image 561
Mikkel R. Lund Avatar asked Jan 28 '20 12:01

Mikkel R. Lund


People also ask

How do you specify app settings for an Azure functions project during local development?

To find the application settings, see Get started in the Azure portal. The Application settings tab maintains settings that are used by your function app. You must select Show values to see the values in the portal. To add a setting in the portal, select New application setting and add the new key-value pair.

Can I run Azure function locally?

Your local functions can connect to live Azure services, and you can debug them on your local computer using the full Functions runtime.

How do I turn off Azure locally?

Input Ctrl+C and Y to terminate functions.


1 Answers

It is possible, but poorly documented. Fabio Cavalcante describes it in a comment here.

You simply have to prefix the setting with AzureFunctionsJobHost in your local.settings.json file (or on Azure) like this:

{
  "IsEncrypted": false,
  "Values": {
    "AzureFunctionsJobHost:Extensions:ServiceBus:MessageHandlerOptions:MaxConcurrentCalls": 32,
    "AzureFunctionsJobHost:Extensions:ServiceBus:MessageHandlerOptions:MaxAutoRenewDuration": "00:10:00"
  }
}

You can also use double underscore (__) instead of colon (:).

like image 98
Mikkel R. Lund Avatar answered Oct 23 '22 10:10

Mikkel R. Lund