Allgemein SharePoint Online

Force TLS 1.2 encryption in PowerShell scripts

Authentication to Office 365

If you are using a Federation Server for the authorization to Office 365 tenant of Microsoft and this Federation Server is not supporting TLS 1.1 encryption anymore you can run into an error if you are connecting in a PowerShell script against this tenant. This will happened special in scripts when you are not using the login prompt getting from web browser. You are often send the credentials by using the parameter -Credential as a secure string.

Issue

Depending of the .NET Framework you are using on your client the default version of the encryption is TLS 1.1. The PowerShell bash is not using TLS 1.2 in this case and this is the reason why the authentication is failing:

Solution

You have to define the TLS 1.2 encryption as default for this PowerShell session. This must be done in the beginning of each script. Please do this:

Reference

0 Kommentare zu “Force TLS 1.2 encryption in PowerShell scripts

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.