Skip to content

Commit ef7ab6f

Browse files
authored
Merge pull request #8 from nzthiago/main
Upgrade to .NET 9 and update Program.cs for telemetry
2 parents 8e1ec66 + 0023560 commit ef7ab6f

File tree

13 files changed

+63
-88
lines changed

13 files changed

+63
-88
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
{
22
"name": "Functions Dev Container",
3-
"image": "mcr.microsoft.com/devcontainers/dotnet:8.0-jammy",
3+
"image": "mcr.microsoft.com/devcontainers/dotnet:dev-9.0-bookworm",
44
"containerUser": "vscode",
55
"features": {
66
//Az CLI install
7-
"azure-cli": {
8-
"version": "2.65"
9-
},
7+
"ghcr.io/devcontainers/features/azure-cli:latest": {},
108
// //Azure Function Core tools + Visual Studio Extension install
11-
"ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": {
12-
"version": "4.0.6280"
13-
},
9+
"ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:1": {},
1410
// azd
15-
"ghcr.io/azure/azure-dev/azd:latest": {
16-
"version": "1.10.2"
17-
}
18-
},
11+
"ghcr.io/azure/azure-dev/azd:latest": {}
12+
},
1913
// Ports Forward config :
2014
// 7071 : Azure Function Debug Port
2115
// 1000[0,1,2] : Azurite storage emulator used with Azure Function

docs/workshop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ During this workshop you will have the instructions to complete each steps. The
2727

2828
> - You will find the instructions and expected configurations for each Lab step in these yellow **TASK** boxes.
2929
> - Log into your Azure subscription on the [Azure Portal][az-portal] using the credentials provided to you.
30-
> - In this version of the implementation, you will be using the [.NET 8 Isolated][in-process-vs-isolated] runtime.
30+
> - In this version of the implementation, you will be using the [.NET 9 Isolated][in-process-vs-isolated] runtime.
3131
3232
</div>
3333

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "9.0.101"
4+
}
5+
}

infra/main.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ param application string = 'hol'
2020
'swedencentral'
2121
'westus3'
2222
])
23-
param location string = 'swedencentral'
23+
param location string = 'eastus2'
2424

2525
@description('Optional. The tags to be assigned to the created resources.')
2626
param tags object = {

infra/modules/host/function.bicep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ param deploymentStorageContainerName string
66
param applicationInsightsName string
77
param tags object = {}
88
param functionAppRuntime string = 'dotnet-isolated'
9-
param functionAppRuntimeVersion string = '8.0'
9+
param functionAppRuntimeVersion string = '9.0'
1010
param maximumInstanceCount int = 100
1111
param instanceMemoryMB int = 2048
1212
param appSettings array = []

solutions/processor/Processor.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
55
<OutputType>Exe</OutputType>
66
<ImplicitUsings>enable</ImplicitUsings>
@@ -9,16 +9,16 @@
99
</PropertyGroup>
1010
<ItemGroup>
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
12-
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
12+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
1313
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.11.0" />
14-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" />
14+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.2.2" />
1515
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
16-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
17-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenAI" Version="0.17.0-alpha" />
16+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
17+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenAI" Version="0.18.0-alpha" />
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
19-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
19+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
2020
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
21-
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
21+
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="2.0.0" />
2222
</ItemGroup>
2323
<ItemGroup>
2424
<None Update="host.json">

solutions/processor/Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
using Microsoft.Azure.Functions.Worker;
22
using Microsoft.Extensions.Hosting;
33
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.Logging;
45

56
var host = new HostBuilder()
67
.ConfigureFunctionsWebApplication()
78
.ConfigureServices(services => {
89
services.AddApplicationInsightsTelemetryWorkerService();
910
services.ConfigureFunctionsApplicationInsights();
11+
services.Configure<LoggerFilterOptions>(options =>
12+
{
13+
LoggerFilterRule toRemove = options.Rules.FirstOrDefault(rule => rule.ProviderName
14+
== "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider");
15+
16+
if (toRemove is not null)
17+
{
18+
options.Rules.Remove(toRemove);
19+
}
20+
});
1021
})
1122
.Build();
1223

solutions/uploader/Program.cs

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
using Microsoft.Azure.Functions.Worker;
22
using Microsoft.Extensions.Hosting;
33
using Microsoft.Extensions.DependencyInjection;
4-
using Microsoft.Extensions.Logging;
5-
using Microsoft.Extensions.Configuration;
64
using Microsoft.Extensions.Azure;
5+
using Microsoft.Extensions.Logging;
76

87
var host = new HostBuilder()
98
.ConfigureFunctionsWebApplication()
@@ -20,22 +19,12 @@
2019
options.Rules.Remove(toRemove);
2120
}
2221
});
23-
services.AddAzureClients(clientBuilder => {
24-
clientBuilder.AddBlobServiceClient(hostContext.Configuration.GetSection("AudioUploadStorage")).WithName("audioUploader");
25-
});
26-
})
27-
.ConfigureAppConfiguration((hostContext, config) =>
28-
{
29-
config.AddJsonFile("host.json", optional: true);
30-
})
31-
.ConfigureLogging((hostingContext, logging) =>
32-
{
33-
logging.AddApplicationInsights(console =>
34-
{
35-
console.IncludeScopes = true;
36-
});
37-
logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
38-
})
22+
services.AddAzureClients(
23+
clientBuilder => {
24+
clientBuilder.AddBlobServiceClient(hostContext.Configuration.GetSection("AudioUploadStorage")).WithName("audioUploader");
25+
}
26+
);
27+
})
3928
.Build();
4029

4130
host.Run();

solutions/uploader/Uploader.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
55
<OutputType>Exe</OutputType>
66
<ImplicitUsings>enable</ImplicitUsings>
@@ -11,14 +11,14 @@
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
1212
<PackageReference Include="Azure.Identity" Version="1.13.1" />
1313
<PackageReference Include="Azure.Storage.Blobs" Version="12.23.0" />
14-
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
14+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
1515
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.11.0" />
1616
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
17-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
17+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
19-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
19+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
2020
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
21-
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
21+
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="2.0.0" />
2222
</ItemGroup>
2323
<ItemGroup>
2424
<None Update="host.json">

src/processor/Processor.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net8.0</TargetFramework>
3+
<TargetFramework>net9.0</TargetFramework>
44
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
55
<OutputType>Exe</OutputType>
66
<ImplicitUsings>enable</ImplicitUsings>
@@ -9,16 +9,16 @@
99
</PropertyGroup>
1010
<ItemGroup>
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
12-
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
12+
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
1313
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.CosmosDB" Version="4.11.0" />
14-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.7" />
14+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.2.2" />
1515
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
16-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
17-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenAI" Version="0.17.0-alpha" />
16+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.0" />
17+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenAI" Version="0.18.0-alpha" />
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
19-
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
19+
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.0" />
2020
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
21-
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.4.0" />
21+
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="2.0.0" />
2222
</ItemGroup>
2323
<ItemGroup>
2424
<None Update="host.json">

0 commit comments

Comments
 (0)