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,...
Answered

Client Secret Connection String for SDK Access

(0) ShareShare
ReportReport
Posted on by 30

Hello all,

I'm trying to connect to Dynamics 365 Online through the SDK / C#. For that, I have created an application in the AD. Through XRMToolbox, I'm perfectly able to connect to the CRM, through the ClientSecret wizard and connection string. However, once I'm trying to use Microsoft.Xrm.Tooling.Connector.CrmServiceClient with the same connection string, I get an error stating that the authority can't be null.

Screenshot-2020_2D00_03_2D00_23-at-08.14.44.png

ClientSecret Authentication should be supported in Xrm.Tooling.Connector since September, does anybody have experience with it?

Details:

Connectionstring used:  "AuthType=ClientSecret;domain=">login.microsoftonline.com/.../xxx.crm4.dynamics.com;ClientId=xxxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx;ClientSecret=<secret>";
Also tried directly: 
var serviceClient = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(new System.Uri("">xxxx.crm4.dynamics.com"), <client ID>, <client secret>, false, "c:\\Temp\\Oauth\\cache.txt");

I also can't use the AuthenticationContext method since that requires async methods. Unfortunately, I don't know how to use that with my WCF webservice.

Thanks!

I have the same question (0)
  • Verified answer
    kojisaiki Profile Picture
    Microsoft Employee on at

    Does connection string with username and password as below work?

    "Url=contoso.crm.dynamics.com; Username=someone@contoso.onmicrosoft.com; Password=password; authtype=Office365"

    From: docs.microsoft.com/.../sample-simplified-connection-quick-start

  • manuBF Profile Picture
    30 on at

    Hi Koji,

    Thank you very much for your answer! Fortunately, I was able to find the error. It wasn't the connection string, but instead:

    I used Visual Studio 2015 to debug my WCF Service. Even though I specified .NET 4.8, the internal Debug engine compiles everything against .NET 4.5. Now, Dynamics 365 requires TLS1.2 for connections, otherwise they get rejected. TLS 1.2 is supported from Version 4.7 onwards, but not in .NET 4.5.

    So in conclusion: The connection string was fine, but I should have also updated the IDE instead of only packages and Framework. The error messages I received were arbitrary errors that result from the rejected connections.

    Thanks for your help!

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 197 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 70

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans