I'm new to Azure's function... I've created a new timer function (will be fired every 30 minutes) and it has to perform a query on a URL, then push data on the buffer..
I've done
public static void Run(TimerInfo myTimer, TraceWriter log)
{
var s = CloudConfigurationManager.GetSetting("url");
log.Info(s);
}
And in my function settings I've
What am I doing wrong? Thanks
Note that for Azure Functions v2 this is no longer true. The following is from Jon Gallant's blog:
For Azure Functions v2, the ConfigurationManager is not supported and you must use the ASP.NET Core Configuration system:
Include the following using statement:
using Microsoft.Extensions.Configuration;
Include the ExecutionContext as a parameter
public static void Run(InboundMessage inboundMessage,
TraceWriter log,
out string outboundMessage,
ExecutionContext context)
Get the IConfiguration
Root
var config = new ConfigurationBuilder()
.SetBasePath(context.FunctionAppDirectory)
.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
And use it to reference AppSettings keys
var password = config["password"]
When debugging locally, it gets the settings from local.settings.json
under the "Values" keyword. When running in Azure, it gets the settings from the Application settings tab.