web
You’re offline. This is a read only version of the page.
close
Skip to main content
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
    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

  • 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!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 179

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 128 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans