Azure app settings at startup

Here's my scenario:

  • I have an azure C # blob trigger function (alwaysON set to true).
  • I am setting the function app's appsettings using the New-AzureRmResource ps cmdlet.
  • I am deploying an azure function by calling a PUT Rest call on "https: //$functionAppName.scm.azurewebsites.net/api/zip/site/wwwroot" to download a zip file (which contains run.csx, function.json and bin / * .Dll files).
  • I am using CloudConfigurationManager.GetSetting (setupKey) to get app settings in * .dll files. I have an IsNullOrWhiteSpace check on these application settings to throw a ConfigurationErrorsException.

Problem: After deployment, the first trigger for an azure function always fires. It fails with a ConfigurationErrorsException that I throw if appsetting is IsNullOrWhiteSpace. About a minute after the first failed trigger, all subsequent triggers start successfully.

Do I need to download apps to install appsettings? Has anyone encountered such a problem before you? What is the workaround for this?

+3


source to share


1 answer


You should not use CloudConfigurationManager

in Azure App Service as this component is for cloud services (another Azure offering). You do not have to fully reference this assembly.



Instead, just use ConfigurationManager.AppSettings["YourSetting"]

to access your app's settings.

+5


source







All Articles