web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to use CrmServiceClient with Client Certificates to authenticate with Dynamics

(1) ShareShare
ReportReport
Posted on by 5

I am trying to authenticate my application with a certificate to on premise Dynamics(Customer Engagement) v9.0.9 with the constructor below but it keeps returning null with no useful errors except "Unable to Login to Dynamics"

The user that the client certificate relates to, is a valid Dynamics System User and my app will connect when using Username and Password via NetworkCredential.

https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.tooling.connector.crmserviceclient.-ctor?view=dynamics-xrmtooling-ce-9#Microsoft_Xrm_Tooling_Connector_CrmServiceClient__ctor_System_Security_Cryptography_X509Certificates_X509Certificate2_System_Security_Cryptography_X509Certificates_StoreName_System_String_System_Uri_System_Boolean_Microsoft_Xrm_Sdk_Discovery_OrganizationDetail_System_String_System_Uri_System_String_

X509Certificate2 certificate = getCertificate();  

CrmServiceClient crmServiceClient = new CrmServiceClient(certificate, StoreName.Root, "", new Uri("http://something.com"), "", false, false, null, , new Uri("http://something.com"), "C://t")

IOrganizationService m_OrgServ =         (IOrganizationService)crmServiceClient.OrganizationWebProxyClient != null ?
(IOrganizationService)crmServiceClient.OrganizationServiceProxy;

I have also tried getting the values from a connectionString which is set within the app.config
 

string connectionString = ConfigurationManager.ConnectionStrings[1].ConnectionString
CrmServiceClient crmServiceClient = new CrmServiceClient(certificateString)

There are no working examples using the x509Certificate to connect to Dynamics on-prem in the documentation and struggling to find any other resources.

Any ideas?

I have the same question (0)
  • Suggested answer
    Denny Deng Profile Picture
    Microsoft Employee on at

    could you try using xrmtoolbox to setup the connection with crm?

    https://www.xrmtoolbox.com/

    3312.Capture.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 192 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans