Posts

Showing posts from June, 2018

TLS 1.2 and PowerShell

To view security protocol that your PowerShell currently uses, use the below command: [Net.ServicePointManager]::SecurityProtocol By default, PowerShell doesn't use TLS 1.2. This causes some problems if you use PowerShell a lot to work with Dynamics 365 and other popular SaaS applications, due to more and more applications are now forcing TLS 1.2 for incoming connections. Taking Dynamics 365 as an example, you may now keep getting the error message "More then one org was returned, retry with an exact org name" when using Get-CrmConnection PowerShell command. This is due to Dynamics 365 now only accepts TLS 1.2 connections, and your PowerShell is not forcing that. To work around it, put the below PowerShell command before making the connection: [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; Just like doing the same in C# code to force the connection to use TLS 1.2, but this is in PowerShell. The Get-CrmConnection ...