Unable to login to Dynamics CRM Organization while using CRMServiceClient / Organization service / TLS Settings
While creating Organization service from custom application to connect with CRM, we faced an issue with TLS settings, and we were unable to log in to Dynamics CRM Organization. The core for the issue was that the default TLS protocol version i.e. (1.0,1.1) was not compatible with .Net Framework.
.Net framework and TLS settings for Dynamics 365
If we are using .Net framework below v4.0, the default TLS would be 1.0 or 1.1 and can be used to create the connection.
If we are using .Net framework v4.0 and above, then the TLS settings need to be forced to explicitly use TLS 1.2.
When we try to connect the custom application with Dynamics 365 it gives the following error of connectivity and doesn’t allow us to create a connection with Dynamics 365.
Unable to login to dynamics CRMOrganizationServiceProxy is null OrganizationWebProxyClient is null…
The reason for the error is that the default TLS for the Connectivity in .Net framework v4.0 is below TLS 1.2. So, the issue can be resolved by adding following line of code before creating the connection. This will make the connection work because we added code that will explicitly use compatible version of TLS i.e. TLS1.2
***If you are using Visual studio 2017, then just change the target version to .Net Framework 4.6 or higher. It internally defaults to TLS1.2 so we don’t need to specify it explicitly.
Dynamics 365 (online) v9.x and TLS
The newer version of Dynamics 365 (online) version 9.x is recommended to use the TLS 1.2 or above for security. All the versions of CRM (online) support TLS 1.0, TLS 1.1 but after the release of Dynamics 365 (online) version 9.x, Microsoft will be blocking connections to the updated products from clients or browsers that are using TLS 1.0 or 1.1.
Please note: This change is only applicable to the online version. On- premises versions would still work.
Hoping that this blog post was helpful!
We look forward to seeing if this resolves your connectivity issue with Microsoft Dynamics 365. If you have any question or queries, do not hesitate to reach out to us!