This page shows how to use Dependency injection in Azure Functions as well as how to customize logging, but it does not show how to get access to the configuration (IConfiguration) in the Configure method.
That is needed to configure Azure clients.
I know we can get the values from the "environment," but it would be better to use a standard way.
For example:
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
// IConfiguration config = ????
builder.Services.AddSingleton<IMyService, Service>(s => {
return new Service(config.GetValue<string>("mysetting"));
});
builder.Services.AddAzureClients(azureBuilder =>
{
azureBuilder.AddServiceBusClient(config.GetConnectionStringOrSetting("QueueConnectionString"));
});
}
}
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.
ID: 5786402e-9d88-5de0-607a-1c2a143af006
Version Independent ID: 15368d1c-b22e-7eb2-413f-cc0d41d2b909
This page shows how to use Dependency injection in Azure Functions as well as how to customize logging, but it does not show how to get access to the configuration (IConfiguration) in the Configure method.
That is needed to configure Azure clients.
I know we can get the values from the "environment," but it would be better to use a standard way.
For example:
Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.