Skip to content

Commit 1f99b54

Browse files
authored
Update bicep template and NuGet packages (#66)
* Update bicep template and NuGet packages * Update storage account RP in bicep * Update dotnet version in global.json * Update refs/packages / 2025-10-07 * Update nuget packages
1 parent 0bed922 commit 1f99b54

File tree

9 files changed

+106
-91
lines changed

9 files changed

+106
-91
lines changed

Contacts.API/Contacts.API.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.11.0" />
9+
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="12.0.0" />
1010
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="9.0.0" />
11-
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
12-
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.45.2" />
11+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
12+
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
13+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.54.0" />
1314
</ItemGroup>
1415

1516
<ItemGroup>

Contacts.API/Startup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using Microsoft.Extensions.DependencyInjection;
2020
using Microsoft.Extensions.Hosting;
2121
using Microsoft.OpenApi.Models;
22+
using AutoMapper;
2223

2324
namespace Contacts.API;
2425

@@ -53,7 +54,7 @@ public void ConfigureServices(IServiceCollection services)
5354

5455
ContactPartitionKeyProvider partitionKeyProvider = new();
5556

56-
services.AddAutoMapper(typeof(ContactsProfile));
57+
services.AddAutoMapper(cfg => { }, typeof(ContactsProfile));
5758
services.AddValidatorsFromAssembly(typeof(CreateContactCommandValidator).Assembly);
5859

5960
services.AddSingleton(container)

Contacts.Application/Contacts.Application.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="AutoMapper" Version="13.0.1" />
9-
<PackageReference Include="FluentValidation" Version="11.11.0" />
10-
<PackageReference Include="MediatR" Version="12.4.1" />
8+
<PackageReference Include="AutoMapper" Version="15.0.1" />
9+
<PackageReference Include="FluentValidation" Version="12.0.0" />
10+
<PackageReference Include="MediatR" Version="12.5.0" />
11+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
1112
</ItemGroup>
1213

1314
<ItemGroup>

Contacts.Domain/Contacts.Domain.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="MediatR" Version="12.4.1" />
9-
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
8+
<PackageReference Include="MediatR" Version="12.5.0" />
9+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
1010
</ItemGroup>
1111

1212
</Project>

Contacts.EventsProcessor/Contacts.EventsProcessor.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.18.2" />
11-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
12-
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.45.2" />
10+
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.20.1" />
11+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
12+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.54.0" />
13+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
1314
</ItemGroup>
1415
</Project>

Contacts.Infrastructure/Contacts.Infrastructure.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<ItemGroup>
4-
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.45.2" />
5-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
4+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.54.0" />
5+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.10" />
6+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
67
</ItemGroup>
78

89
<ItemGroup>

Contacts.Tests/Contacts.Tests.csproj

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="FluentValidation" Version="11.11.0" />
11-
<PackageReference Include="MediatR" Version="12.4.1" />
12-
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.45.2" />
13-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
14-
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
15-
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
16-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
10+
<PackageReference Include="FluentValidation" Version="12.0.0" />
11+
<PackageReference Include="MediatR" Version="12.5.0" />
12+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.54.0" />
13+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.10" />
14+
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="9.0.10" />
15+
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.10" />
16+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
1818
<PackageReference Include="Moq" Version="4.20.72" />
19+
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
1920
<PackageReference Include="xunit" Version="2.9.3" />
20-
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.1">
21+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
2122
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2223
<PrivateAssets>all</PrivateAssets>
2324
</PackageReference>
24-
<PackageReference Include="coverlet.collector" Version="6.0.3">
25+
<PackageReference Include="coverlet.collector" Version="6.0.4">
2526
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2627
<PrivateAssets>all</PrivateAssets>
2728
</PackageReference>

Deployment/deploy.bicep

Lines changed: 75 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param location string = resourceGroup().location
22

33
// Cosmos DB Account
4-
resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
4+
resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2025-04-15' = {
55
name: 'cosmos-tobp-${uniqueString(resourceGroup().id)}'
66
location: location
77
kind: 'GlobalDocumentDB'
@@ -22,7 +22,7 @@ resource cosmosDbAccount 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
2222
}
2323

2424
// Cosmos DB
25-
resource cosmosDbDatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2024-05-15' = {
25+
resource cosmosDbDatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@2025-04-15' = {
2626
parent: cosmosDbAccount
2727
name: 'tobp'
2828
location: location
@@ -39,7 +39,7 @@ resource cosmosDbDatabase 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases@20
3939
}
4040

4141
// Data Container
42-
resource containerData 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2024-05-15' = {
42+
resource containerData 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2025-04-15' = {
4343
parent: cosmosDbDatabase
4444
name: 'data'
4545
location: location
@@ -72,7 +72,7 @@ resource containerData 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/conta
7272
}
7373

7474
// Leases Container
75-
resource containerLeases 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2024-05-15' = {
75+
resource containerLeases 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers@2025-04-15' = {
7676
parent: cosmosDbDatabase
7777
name: 'leases'
7878
location: location
@@ -104,7 +104,7 @@ resource containerLeases 'Microsoft.DocumentDB/databaseAccounts/sqlDatabases/con
104104
}
105105

106106
// ServiceBus
107-
resource sb 'Microsoft.ServiceBus/namespaces@2021-11-01' = {
107+
resource sb 'Microsoft.ServiceBus/namespaces@2024-01-01' = {
108108
name: 'sb-tobp-${uniqueString(resourceGroup().id)}'
109109
location: location
110110
sku: {
@@ -126,7 +126,7 @@ resource sb 'Microsoft.ServiceBus/namespaces@2021-11-01' = {
126126
enableExpress: false
127127
}
128128

129-
resource sbtTestSubscription 'subscriptions@2021-11-01' = {
129+
resource sbtTestSubscription 'subscriptions@2024-01-01' = {
130130
name: 'testSubscription'
131131
properties: {
132132
lockDuration: 'PT5M'
@@ -141,18 +141,9 @@ resource sb 'Microsoft.ServiceBus/namespaces@2021-11-01' = {
141141
}
142142
}
143143

144-
// Storage Account for Function
145-
resource stgForFunctions 'Microsoft.Storage/storageAccounts@2023-05-01' = {
146-
name: 'stfn${take(uniqueString(resourceGroup().id), 11)}'
147-
location: location
148-
kind: 'StorageV2'
149-
sku: {
150-
name: 'Standard_LRS'
151-
}
152-
}
153144

154145
// ApplicationInsights
155-
resource workspace 'Microsoft.OperationalInsights/workspaces@2023-09-01' = {
146+
resource workspace 'Microsoft.OperationalInsights/workspaces@2025-02-01' = {
156147
name: 'ws-tobp-${uniqueString(resourceGroup().id)}'
157148
location: location
158149
properties: {
@@ -172,89 +163,106 @@ resource appi 'Microsoft.Insights/components@2020-02-02' = {
172163
}
173164
}
174165

175-
// Dynamic Hostingplan
176-
resource hostingPlan 'Microsoft.Web/serverfarms@2023-12-01' = {
177-
name: 'plan-tobp-${uniqueString(resourceGroup().id)}'
166+
// Storage Account for Azure Function
167+
resource storageAccount 'Microsoft.Storage/storageAccounts@2025-01-01' = {
168+
name: 'st${replace(uniqueString(resourceGroup().id), '-', '')}'
169+
location: location
170+
sku: {
171+
name: 'Standard_LRS'
172+
}
173+
kind: 'StorageV2'
174+
properties: {
175+
accessTier: 'Hot'
176+
}
177+
}
178+
179+
// App Service Plan for Azure Function
180+
resource functionAppServicePlan 'Microsoft.Web/serverfarms@2024-11-01' = {
181+
name: 'asp-func-tobp-${uniqueString(resourceGroup().id)}'
178182
location: location
179183
sku: {
180184
name: 'Y1'
181185
tier: 'Dynamic'
182186
}
183-
properties: {}
187+
properties: {
188+
reserved: false
189+
}
184190
}
185191

186-
// Function App
187-
resource functionApp 'Microsoft.Web/sites@2023-12-01' = {
188-
name: 'funcapp-tobp-${uniqueString(resourceGroup().id)}'
192+
// Azure Function App
193+
resource functionApp 'Microsoft.Web/sites@2024-11-01' = {
194+
name: 'func-tobp-${uniqueString(resourceGroup().id)}'
189195
location: location
190196
kind: 'functionapp'
191197
properties: {
192-
httpsOnly: true
193-
serverFarmId: hostingPlan.id
198+
serverFarmId: functionAppServicePlan.id
194199
siteConfig: {
195200
appSettings: [
196201
{
197-
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
198-
value: appi.properties.InstrumentationKey
202+
name: 'AzureWebJobsStorage'
203+
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${storageAccount.listKeys().keys[0].value}'
199204
}
200205
{
201-
name: 'AzureWebJobsStorage'
202-
value: 'DefaultEndpointsProtocol=https;AccountName=${stgForFunctions.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${stgForFunctions.listKeys().keys[0].value}'
206+
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
207+
value: 'DefaultEndpointsProtocol=https;AccountName=${storageAccount.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${storageAccount.listKeys().keys[0].value}'
208+
}
209+
{
210+
name: 'WEBSITE_CONTENTSHARE'
211+
value: toLower('func-tobp-${uniqueString(resourceGroup().id)}')
203212
}
204213
{
205214
name: 'FUNCTIONS_EXTENSION_VERSION'
206215
value: '~4'
207216
}
208217
{
209218
name: 'FUNCTIONS_WORKER_RUNTIME'
210-
value: 'dotnet'
219+
value: 'dotnet-isolated'
211220
}
212221
{
213-
name: 'SERVICEBUS_CONNECTION'
214-
value: '${listKeys('${sb.id}/AuthorizationRules/RootManageSharedAccessKey', sb.apiVersion).primaryConnectionString}'
222+
name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
223+
value: appi.properties.InstrumentationKey
215224
}
216225
{
217-
name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
218-
value: 'DefaultEndpointsProtocol=https;AccountName=${stgForFunctions.name};EndpointSuffix=${environment().suffixes.storage};AccountKey=${stgForFunctions.listKeys().keys[0].value}'
226+
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
227+
value: appi.properties.ConnectionString
228+
}
229+
{
230+
name: 'Cosmos:Url'
231+
value: 'https://${cosmosDbAccount.name}.documents.azure.com:443/'
232+
}
233+
{
234+
name: 'Cosmos:Key'
235+
value: listKeys('${cosmosDbAccount.id}', cosmosDbAccount.apiVersion).primaryMasterKey
219236
}
220-
]
221-
}
222-
}
223-
}
224-
225-
// Function
226-
resource function 'Microsoft.Web/sites/functions@2023-12-01' = {
227-
parent: functionApp
228-
name: 'funcapp-tobp-${uniqueString(resourceGroup().id)}'
229-
properties: {
230-
function_app_id: functionApp.id
231-
config: {
232-
bindings: [
233237
{
234-
name: 'mySbMsg'
235-
type: 'serviceBusTrigger'
236-
direction: 'in'
237-
topicName: 'sbt-contacts'
238-
subscriptionName: 'testSubscription'
239-
connection: 'SERVICEBUS_CONNECTION'
240-
isSessionsEnabled: true
238+
name: 'Cosmos:Db'
239+
value: 'tobp'
240+
}
241+
{
242+
name: 'Cosmos:Container'
243+
value: 'data'
244+
}
245+
{
246+
name: 'Events:Ttl'
247+
value: '864000'
248+
}
249+
{
250+
name: 'ServiceBus:ConnectionString'
251+
value: listKeys('${sb.id}/AuthorizationRules/RootManageSharedAccessKey', sb.apiVersion).primaryConnectionString
241252
}
242253
]
254+
netFrameworkVersion: 'v8.0'
255+
use32BitWorkerProcess: false
256+
cors: {
257+
allowedOrigins: [
258+
'https://portal.azure.com'
259+
]
260+
}
243261
}
244-
files: {
245-
'run.csx': '''using System;
246-
using System.Threading.Tasks;
247-
248-
public static void Run(string mySbMsg, ILogger log)
249-
{
250-
log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
251-
}'''
252-
}
253-
254262
}
255263
}
256264

257-
resource appServicePlan 'Microsoft.Web/serverfarms@2023-12-01' = {
265+
resource appServicePlan 'Microsoft.Web/serverfarms@2024-11-01' = {
258266
name: 'appservice-tobp-${uniqueString(resourceGroup().id)}'
259267
location: location
260268
sku: {
@@ -264,7 +272,7 @@ resource appServicePlan 'Microsoft.Web/serverfarms@2023-12-01' = {
264272
properties: {}
265273
}
266274

267-
resource appService 'Microsoft.Web/sites@2023-12-01' = {
275+
resource appService 'Microsoft.Web/sites@2024-11-01' = {
268276
name: 'webapp-tobp-${uniqueString(resourceGroup().id)}'
269277
location: location
270278
properties: {
@@ -309,3 +317,4 @@ output cosmosUri string = 'https://${cosmosDbAccount.name}.documents.azure.com:4
309317
output cosmosDbName string = 'tobp'
310318
output cosmosDbDataContainerName string = 'data'
311319
output cosmosDbLeasesContainerName string = 'leases'
320+
output functionAppName string = functionApp.name

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "8.0.0",
3+
"version": "8.0.413",
44
"rollForward": "minor",
55
"allowPrerelease": false
66
}

0 commit comments

Comments
 (0)