Skip to main content

Notifications

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!

  • manuBF Profile Picture
    30 on at
    RE: Client Secret Connection String for SDK Access

    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!

  • Verified answer
    kojisaiki Profile Picture
    on at
    RE: Client Secret Connection String for SDK Access

    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

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

#3
Eugen Podkorytov Profile Picture

Eugen Podkorytov 87

Overall leaderboard

Product updates

Dynamics 365 release plans