diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index 8096a7c0..832d4690 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -694,12 +694,6 @@ "{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1" - ] - }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index d45e2583..97839969 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -693,12 +693,6 @@ "{{ template_dir }}/scripts/Installers/Validate-AzureModules.ps1" ] }, - { - "type": "powershell", - "scripts":[ - "{{ template_dir }}/scripts/Installers/Validate-DotnetTLS.ps1" - ] - }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Update-DotnetTLS.ps1 b/images/win/scripts/Installers/Update-DotnetTLS.ps1 index f07e3ca0..b854e660 100644 --- a/images/win/scripts/Installers/Update-DotnetTLS.ps1 +++ b/images/win/scripts/Installers/Update-DotnetTLS.ps1 @@ -13,6 +13,7 @@ if(Test-Path $registryPath){ $registryPath = "HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319" if(Test-Path $registryPath){ Set-ItemProperty -Path $registryPath -Name $name -Value $value -Type DWORD -} +} +Invoke-PesterTests -TestFile "Tools" -TestName "DotnetTLS" diff --git a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 b/images/win/scripts/Installers/Validate-DotnetTLS.ps1 deleted file mode 100644 index 0d17c7b0..00000000 --- a/images/win/scripts/Installers/Validate-DotnetTLS.ps1 +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -## File: Validate-DotnetTLS.ps1 -## Desc: Validate DotNetFramework security protocol to TLS 1.2 -################################################################################ - -$protocols = [Net.ServicePointManager]::SecurityProtocol -$protocolArr = $protocols -split ', ' -if ($protocolArr.Contains('Tls12')) -{ - Write-Host 'Tls 1.2 has been enabled.' -} -else -{ - Write-Host 'Tls 1.2 has not been enabled.' - exit 1 -} - - diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 16be04e7..f2317be3 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -16,6 +16,12 @@ Describe "Kind" { } } +Describe "DotnetTLS" { + It "Tls 1.2 is enabled" { + [Net.ServicePointManager]::SecurityProtocol -band "Tls12" | Should -Be Tls12 + } +} + Describe "Jq" { It "Jq" { "jq -n ." | Should -ReturnZeroExitCode