Skip to content

Commit 5a8f855

Browse files
authored
Merge pull request #114 from Azure-Samples/tls_minimums
Improve security on templates.
2 parents 22fe55f + 1e416e6 commit 5a8f855

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

bicep/modules/apim.bicep

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@description('API Management DB account name')
22
param apimName string
33
param appInsightsName string
4+
@secure()
45
param appInsightsInstrumentationKey string
56
param resourceTags object
67

@@ -22,7 +23,7 @@ var location = resourceGroup().location
2223
var publisherEmail = '[email protected]'
2324
var publisherName = 'Company Name'
2425

25-
resource apiManagement 'Microsoft.ApiManagement/service@2021-01-01-preview' = {
26+
resource apiManagement 'Microsoft.ApiManagement/service@2021-08-01' = {
2627
name: apimName
2728
location: location
2829
tags: resourceTags
@@ -33,6 +34,23 @@ resource apiManagement 'Microsoft.ApiManagement/service@2021-01-01-preview' = {
3334
properties: {
3435
publisherEmail: publisherEmail
3536
publisherName: publisherName
37+
customProperties: {
38+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10': 'False'
39+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11': 'False'
40+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30': 'False'
41+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10': 'False'
42+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11': 'False'
43+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30': 'False'
44+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2': 'True'
45+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168': 'False'
46+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA': 'False'
47+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA': 'False'
48+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256': 'False'
49+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA': 'False'
50+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA256': 'False'
51+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA': 'False'
52+
'Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_GCM_SHA256': 'False'
53+
}
3654
}
3755
identity: {
3856
type: 'SystemAssigned'

bicep/modules/cosmosdb.bicep

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var containerNames = [
1616
'archiver'
1717
]
1818

19-
resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' = {
19+
resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2024-05-15' = {
2020
name: toLower(accountName)
2121
kind: 'GlobalDocumentDB'
2222
location: location
@@ -38,7 +38,8 @@ resource cosmosAccount 'Microsoft.DocumentDB/databaseAccounts@2021-06-15' = {
3838
backupIntervalInMinutes: 240
3939
backupRetentionIntervalInHours: 8
4040
}
41-
}
41+
}
42+
minimalTlsVersion: 'Tls12'
4243
}
4344
}
4445

bicep/modules/functions.bicep

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ param functionApps array
44
param appServicePlanName string
55
param location string = resourceGroup().location
66
param staticWebAppURL string
7+
@secure()
78
param appInsightsInstrumentationKey string
89
param resourceTags object
910

@@ -20,6 +21,7 @@ resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
2021
kind: 'StorageV2'
2122
properties: {
2223
supportsHttpsTrafficOnly: true
24+
minimumTlsVersion: 'TLS1_2'
2325
encryption: {
2426
services: {
2527
file: {
@@ -48,7 +50,7 @@ resource plan 'Microsoft.Web/serverFarms@2020-06-01' = {
4850
properties: {}
4951
}
5052

51-
resource functionApp 'Microsoft.Web/sites@2020-06-01' = [for functionApp in functionApps :{
53+
resource functionApp 'Microsoft.Web/sites@2023-12-01' = [for functionApp in functionApps :{
5254
name: '${functionAppPrefix}${functionApp}'
5355
location: location
5456
kind: 'functionapp'
@@ -86,6 +88,7 @@ resource functionApp 'Microsoft.Web/sites@2020-06-01' = [for functionApp in func
8688
staticWebAppURL
8789
]
8890
}
91+
minTlsVersion: '1.2'
8992
}
9093
httpsOnly: true
9194
}

bicep/modules/sqldb.bicep

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ param administratorLogin string
66
param administratorPassword string
77
param resourceTags object
88

9-
resource sqlServer 'Microsoft.Sql/servers@2021-05-01-preview' = {
9+
resource sqlServer 'Microsoft.Sql/servers@2022-11-01-preview' = {
1010
name: sqlServerName
1111
location: location
1212
tags: resourceTags
1313
properties: {
1414
administratorLogin: administratorLogin
1515
administratorLoginPassword: administratorPassword
1616
version: '12.0'
17+
minimalTlsVersion: '1.2'
1718
}
1819
dependsOn: []
1920
}
@@ -34,3 +35,18 @@ resource servers_rideshare_server_name_databases_Rideshare_name 'Microsoft.Sql/s
3435
zoneRedundant: false
3536
}
3637
}
38+
39+
resource sqlAuditSettings 'Microsoft.Sql/servers/auditingSettings@2022-08-01-preview' = {
40+
name: 'default'
41+
parent: sqlServer
42+
properties: {
43+
isAzureMonitorTargetEnabled: true
44+
state: 'Enabled'
45+
retentionDays: 7
46+
auditActionsAndGroups: [
47+
'SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP'
48+
'FAILED_DATABASE_AUTHENTICATION_GROUP'
49+
'BATCH_COMPLETED_GROUP'
50+
]
51+
}
52+
}

0 commit comments

Comments
 (0)