0
votes

We are running small .net application in azure webapps which collects data and trigger .ps1 file to send email via powershell send-mailmessage

.Netversion : 4.8 platform = 32bit HTTP version : 1.1 Minimum TLS Version : 1.2 HTTPS Only: Off

Now the issue is mails are sending with TLS1.0, as you are aware TLS 1.0 not support in future we wanted to enforce it to TLS 1.2, on webapp TLS settings enabled TLS as 1.2 but still taking it as 1.0 only

where as while sending same from local powershell its taking TLS2.0, please help me on how to send to emails with minimum TLS 1.2

1
"its taking TLS2.0" - that's not a real protocol - is it a typo, or did you test with a tool that actually said that? In any case, please detail how you asserted that these were the protocol versions chosenMathias R. Jessen
i Have verified this on mha.azurewebsites.net, i have sent some test mails from webapp and local after that i have compared both emails internet headers, there i can see the email triggers from azure webapp taking TLS 1.0avinash
Can you mark below response as an answer if it helped you?hsingh

1 Answers

0
votes

You can force Powershell to use TLS 1.2 by adding below command in your PowerShell profile:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

It’s probably better to include the command in any script which uses the Send-MailMessage cmdlet.

The issue has been known for a while and other email platforms also insist on TLS 1.2 connection and use the same solution for PowerShell (here’s an example).

Do check out Force PowerShell to Use TLS 1.2.