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.
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!
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!
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156