Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Function1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace azure_function_config
{
public static class Function1
{
[FunctionName("Function1")]
public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]
HttpRequest req, TraceWriter log, ExecutionContext context)
HttpRequest req, ILogger log, ExecutionContext context)
{
var config = new ConfigurationBuilder()
.SetBasePath(context.FunctionAppDirectory)
Expand All @@ -25,10 +26,10 @@ public static IActionResult Run([HttpTrigger(AuthorizationLevel.Function, "get",
var cstr = config.GetConnectionString("SqlConnectionString");
var setting1 = config["Setting1"];

log.Info(cstr);
log.Info(setting1);
log.LogInformation($"{cstr}");
log.LogInformation($"{setting1}");

log.Info("C# HTTP trigger function processed a request.");
log.LogInformation("C# HTTP trigger function processed a request.");

string name = req.Query["name"];

Expand Down
8 changes: 4 additions & 4 deletions azure-function-config.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
<TargetFramework>netcoreapp2.1</TargetFramework>
<AzureFunctionsVersion>V2</AzureFunctionsVersion>
<RootNamespace>azure_function_config</RootNamespace>
<AssemblyName>azure_function_config</AssemblyName>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.6" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0-preview1-25914-04" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0-preview3.19128.7" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand Down
3 changes: 2 additions & 1 deletion host.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
{
"version": "2.0"
}
1 change: 1 addition & 0 deletions local.settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
"Setting1": "Value1"
Expand Down