Correct use of app and local settings with Azure Function Bindings?












0















I am developing some Azure Functions in Visual Studio 2017 that use EventHub, ServiceBus, SignalR, CosmosDB and other bindings. Many of the bindings have a Connection or ConnectionStringSetting argument that is supposed to be set to the name of the setting that holds the connection string.



For example:



[EventHubTrigger(eventHubName: "the-hub-name", Connection = "MySettingName")] TheRequestEventType request


I have the MySettingName value in the Values section of my local.settings.json. This all works fine for running and debugging locally.



When I added MySettingName to the App Settings on the Azure Functions App and deployed the App things do not work. When the app starts I get exceptions stating that the connection string is null: Error indexing method 'MyEventHandler.Run' Value cannot be null. Parameter name: connectionString (full call stack provided below).



What is the correct way to use the Connection or ConnectionStringSetting arguments?



Is there some naming convention that must be used like APPSETTING_MySettingName?



I've been searching for documentation on this and using App Settings with Function Apps in general but not found anything that address this, sorry in advance if I've missed something obvious.



Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 175)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexTypeAsync>d__13.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 103)
Inner exception System.ArgumentNullException handled at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext:
at Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse (Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at Microsoft.Azure.EventHubs.Processor.EventProcessorHost..ctor (Microsoft.Azure.EventHubs.Processor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c)
at Microsoft.Azure.WebJobs.EventHubs.EventHubOptions.GetEventProcessorHost (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsConfigEventHubOptions.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 247)
at Microsoft.Azure.WebJobs.EventHubs.EventHubTriggerAttributeBindingProvider.TryCreateAsync (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsTriggersEventHubTriggerAttributeBindingProvider.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 68)
at Microsoft.Azure.WebJobs.Host.Triggers.CompositeTriggerBindingProvider+<TryCreateAsync>d__2.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostTriggersCompositeTriggerBindingProvider.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 22)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsyncCore>d__18.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 190)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 167)









share|improve this question





























    0















    I am developing some Azure Functions in Visual Studio 2017 that use EventHub, ServiceBus, SignalR, CosmosDB and other bindings. Many of the bindings have a Connection or ConnectionStringSetting argument that is supposed to be set to the name of the setting that holds the connection string.



    For example:



    [EventHubTrigger(eventHubName: "the-hub-name", Connection = "MySettingName")] TheRequestEventType request


    I have the MySettingName value in the Values section of my local.settings.json. This all works fine for running and debugging locally.



    When I added MySettingName to the App Settings on the Azure Functions App and deployed the App things do not work. When the app starts I get exceptions stating that the connection string is null: Error indexing method 'MyEventHandler.Run' Value cannot be null. Parameter name: connectionString (full call stack provided below).



    What is the correct way to use the Connection or ConnectionStringSetting arguments?



    Is there some naming convention that must be used like APPSETTING_MySettingName?



    I've been searching for documentation on this and using App Settings with Function Apps in general but not found anything that address this, sorry in advance if I've missed something obvious.



    Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:
    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 175)
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexTypeAsync>d__13.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 103)
    Inner exception System.ArgumentNullException handled at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext:
    at Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse (Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
    at Microsoft.Azure.EventHubs.Processor.EventProcessorHost..ctor (Microsoft.Azure.EventHubs.Processor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c)
    at Microsoft.Azure.WebJobs.EventHubs.EventHubOptions.GetEventProcessorHost (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsConfigEventHubOptions.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 247)
    at Microsoft.Azure.WebJobs.EventHubs.EventHubTriggerAttributeBindingProvider.TryCreateAsync (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsTriggersEventHubTriggerAttributeBindingProvider.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 68)
    at Microsoft.Azure.WebJobs.Host.Triggers.CompositeTriggerBindingProvider+<TryCreateAsync>d__2.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostTriggersCompositeTriggerBindingProvider.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 22)
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsyncCore>d__18.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 190)
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 167)









    share|improve this question



























      0












      0








      0








      I am developing some Azure Functions in Visual Studio 2017 that use EventHub, ServiceBus, SignalR, CosmosDB and other bindings. Many of the bindings have a Connection or ConnectionStringSetting argument that is supposed to be set to the name of the setting that holds the connection string.



      For example:



      [EventHubTrigger(eventHubName: "the-hub-name", Connection = "MySettingName")] TheRequestEventType request


      I have the MySettingName value in the Values section of my local.settings.json. This all works fine for running and debugging locally.



      When I added MySettingName to the App Settings on the Azure Functions App and deployed the App things do not work. When the app starts I get exceptions stating that the connection string is null: Error indexing method 'MyEventHandler.Run' Value cannot be null. Parameter name: connectionString (full call stack provided below).



      What is the correct way to use the Connection or ConnectionStringSetting arguments?



      Is there some naming convention that must be used like APPSETTING_MySettingName?



      I've been searching for documentation on this and using App Settings with Function Apps in general but not found anything that address this, sorry in advance if I've missed something obvious.



      Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 175)
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexTypeAsync>d__13.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 103)
      Inner exception System.ArgumentNullException handled at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext:
      at Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse (Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
      at Microsoft.Azure.EventHubs.Processor.EventProcessorHost..ctor (Microsoft.Azure.EventHubs.Processor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c)
      at Microsoft.Azure.WebJobs.EventHubs.EventHubOptions.GetEventProcessorHost (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsConfigEventHubOptions.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 247)
      at Microsoft.Azure.WebJobs.EventHubs.EventHubTriggerAttributeBindingProvider.TryCreateAsync (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsTriggersEventHubTriggerAttributeBindingProvider.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 68)
      at Microsoft.Azure.WebJobs.Host.Triggers.CompositeTriggerBindingProvider+<TryCreateAsync>d__2.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostTriggersCompositeTriggerBindingProvider.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 22)
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsyncCore>d__18.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 190)
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 167)









      share|improve this question
















      I am developing some Azure Functions in Visual Studio 2017 that use EventHub, ServiceBus, SignalR, CosmosDB and other bindings. Many of the bindings have a Connection or ConnectionStringSetting argument that is supposed to be set to the name of the setting that holds the connection string.



      For example:



      [EventHubTrigger(eventHubName: "the-hub-name", Connection = "MySettingName")] TheRequestEventType request


      I have the MySettingName value in the Values section of my local.settings.json. This all works fine for running and debugging locally.



      When I added MySettingName to the App Settings on the Azure Functions App and deployed the App things do not work. When the app starts I get exceptions stating that the connection string is null: Error indexing method 'MyEventHandler.Run' Value cannot be null. Parameter name: connectionString (full call stack provided below).



      What is the correct way to use the Connection or ConnectionStringSetting arguments?



      Is there some naming convention that must be used like APPSETTING_MySettingName?



      I've been searching for documentation on this and using App Settings with Function Apps in general but not found anything that address this, sorry in advance if I've missed something obvious.



      Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 175)
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexTypeAsync>d__13.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 103)
      Inner exception System.ArgumentNullException handled at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext:
      at Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse (Microsoft.WindowsAzure.Storage, Version=9.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
      at Microsoft.Azure.EventHubs.Processor.EventProcessorHost..ctor (Microsoft.Azure.EventHubs.Processor, Version=2.1.0.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c)
      at Microsoft.Azure.WebJobs.EventHubs.EventHubOptions.GetEventProcessorHost (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsConfigEventHubOptions.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 247)
      at Microsoft.Azure.WebJobs.EventHubs.EventHubTriggerAttributeBindingProvider.TryCreateAsync (Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.Extensions.EventHubsTriggersEventHubTriggerAttributeBindingProvider.csMicrosoft.Azure.WebJobs.EventHubs, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 68)
      at Microsoft.Azure.WebJobs.Host.Triggers.CompositeTriggerBindingProvider+<TryCreateAsync>d__2.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostTriggersCompositeTriggerBindingProvider.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 22)
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsyncCore>d__18.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 190)
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
      at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:projectsazure-webjobs-sdk-rqm4tsrcMicrosoft.Azure.WebJobs.HostIndexersFunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 167)






      c# azure azure-functions






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 6:41









      Jerry Liu

      11.4k11233




      11.4k11233










      asked Jan 3 at 0:08









      Eli PulsiferEli Pulsifer

      1349




      1349
























          2 Answers
          2






          active

          oldest

          votes


















          1














          You did it right that adding those Connection String settings(e.g. MySettingName and corresponding value)to the App Settings on the Azure Functions. There's no naming convention either.



          The null value exception probably results from missing AzureWebJobsStorage in App Settings, this storage account connection string is required for all triggers except Http trigger. The storage account must be a general-purpose one that supports blobs, queues, and tables.






          share|improve this answer































            0














            The fact that it works when debugging locally means, your local.settings.json is correct and has "MySettingName" configured correctly.



            As far as I can understand, it doesn't work when you deploy to Azure. When running in Azure, it doesn't look at local.seetings.json. Instead Azure looks at "Application Settings" of your function app.



            So edit application settings and add "MySettingName" there. That should solve your issue.



            enter image description here






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014795%2fcorrect-use-of-app-and-local-settings-with-azure-function-bindings%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              You did it right that adding those Connection String settings(e.g. MySettingName and corresponding value)to the App Settings on the Azure Functions. There's no naming convention either.



              The null value exception probably results from missing AzureWebJobsStorage in App Settings, this storage account connection string is required for all triggers except Http trigger. The storage account must be a general-purpose one that supports blobs, queues, and tables.






              share|improve this answer




























                1














                You did it right that adding those Connection String settings(e.g. MySettingName and corresponding value)to the App Settings on the Azure Functions. There's no naming convention either.



                The null value exception probably results from missing AzureWebJobsStorage in App Settings, this storage account connection string is required for all triggers except Http trigger. The storage account must be a general-purpose one that supports blobs, queues, and tables.






                share|improve this answer


























                  1












                  1








                  1







                  You did it right that adding those Connection String settings(e.g. MySettingName and corresponding value)to the App Settings on the Azure Functions. There's no naming convention either.



                  The null value exception probably results from missing AzureWebJobsStorage in App Settings, this storage account connection string is required for all triggers except Http trigger. The storage account must be a general-purpose one that supports blobs, queues, and tables.






                  share|improve this answer













                  You did it right that adding those Connection String settings(e.g. MySettingName and corresponding value)to the App Settings on the Azure Functions. There's no naming convention either.



                  The null value exception probably results from missing AzureWebJobsStorage in App Settings, this storage account connection string is required for all triggers except Http trigger. The storage account must be a general-purpose one that supports blobs, queues, and tables.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 3 at 7:13









                  Jerry LiuJerry Liu

                  11.4k11233




                  11.4k11233

























                      0














                      The fact that it works when debugging locally means, your local.settings.json is correct and has "MySettingName" configured correctly.



                      As far as I can understand, it doesn't work when you deploy to Azure. When running in Azure, it doesn't look at local.seetings.json. Instead Azure looks at "Application Settings" of your function app.



                      So edit application settings and add "MySettingName" there. That should solve your issue.



                      enter image description here






                      share|improve this answer




























                        0














                        The fact that it works when debugging locally means, your local.settings.json is correct and has "MySettingName" configured correctly.



                        As far as I can understand, it doesn't work when you deploy to Azure. When running in Azure, it doesn't look at local.seetings.json. Instead Azure looks at "Application Settings" of your function app.



                        So edit application settings and add "MySettingName" there. That should solve your issue.



                        enter image description here






                        share|improve this answer


























                          0












                          0








                          0







                          The fact that it works when debugging locally means, your local.settings.json is correct and has "MySettingName" configured correctly.



                          As far as I can understand, it doesn't work when you deploy to Azure. When running in Azure, it doesn't look at local.seetings.json. Instead Azure looks at "Application Settings" of your function app.



                          So edit application settings and add "MySettingName" there. That should solve your issue.



                          enter image description here






                          share|improve this answer













                          The fact that it works when debugging locally means, your local.settings.json is correct and has "MySettingName" configured correctly.



                          As far as I can understand, it doesn't work when you deploy to Azure. When running in Azure, it doesn't look at local.seetings.json. Instead Azure looks at "Application Settings" of your function app.



                          So edit application settings and add "MySettingName" there. That should solve your issue.



                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 3 at 1:07









                          Kosala WKosala W

                          1,87011017




                          1,87011017






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54014795%2fcorrect-use-of-app-and-local-settings-with-azure-function-bindings%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Angular Downloading a file using contenturl with Basic Authentication

                              Monofisismo

                              Olmecas