Skip to content

Commit 771b7e2

Browse files
authored
Merge pull request #1265 from MikeRayMSFT/master
Publish set-reset-tls.ps1
2 parents 206734d + b535ca5 commit 771b7e2

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

samples/features/security/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@
1010
[Azure SQL Security Demo](https://github.com/Microsoft/azure-sql-security-sample)
1111

1212
[SQL 2016 Security Demo](contoso-clinic)
13+
14+
[TLS 1.3 example](tls-1-3)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Enable TLS 1.3 for SQL Server
2+
3+
[set-reset-tls.ps1](./set-reset-tls.ps1) demonstrates how you can set the registry setting to use specific encryption protocols.
4+
5+
Learn more at [Transport Layer Security (TLS) registry settings](https://learn.microsoft.com/windows-server/security/tls/tls-registry-settings?tabs=diffie-hellman).
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Learn more at https://learn.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings?tabs=diffie-hellman
2+
Set-StrictMode -Version Latest
3+
4+
$base = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\'
5+
$protocols = [ordered]@{
6+
"SSL 2.0" = $false
7+
"SSL 3.0" = $false
8+
"TLS 1.0" = $false
9+
"TLS 1.1" = $false
10+
"TLS 1.2" = $true
11+
"TLS 1.3" = $true
12+
}
13+
14+
foreach ($version in $protocols.Keys) {
15+
16+
$enabledValue = $protocols[$version]
17+
$path = $base + $version + '\Server'
18+
19+
New-Item $path -Force | Out-Null
20+
New-ItemProperty -Path $path `
21+
-Name 'Enabled' `
22+
-Value $enabledValue `
23+
-PropertyType 'DWord' `
24+
-Force | Out-Null
25+
26+
Write-Host "$version is $enabledValue."
27+
}

0 commit comments

Comments
 (0)