Dynamics 365 authentication from WCF

1k views Asked by At

I need to create a WCF web service for pushing and pulling leads from Dynamics 365. In the Dynamics 365 SDK I can see two authentication classes. simplified connection(SDK\SampleCode\CS\GeneralProgramming\Authentication) and AuthenticatewithnoHelp (SDK\SampleCode\CS\GeneralProgramming\Authentication\AuthenticateWithNoHelp). I have tested these classes and both the methods are working. Can somebody please advise which class I need to use for the WCF service and why. which is the best one to use for integrations via WCF. I am using this service for both online and on-premise versions.

1

There are 1 answers

1
Aron On BEST ANSWER

I think those samples are the older way of doing things.

For starting a new project now you'd probably want to either use CRM's Web API, or connect via CrmServiceClient, which is in the Microsoft.Xrm.Tooling.Connector library.

Using NuGet you can get the Microsoft.CrmSdk.XrmTooling.CoreAssembly package and you'll be off to the races.

Here are a couple other helpful links:

Build Windows client applications using the XRM tools

Sample: Quick start for XRM Tooling API

Here are various connection string examples:

CRM 2016 and Dynamics 365 online:

<add name="dev26" connectionString="Url=https://dev26.crm.dynamics.com; [email protected]; Password=Pass; AuthType=Office365" />

On-premise with integrated security:

<add name="prod" connectionString="Url=http://myserver/AdventureWorksCycle;"/>

On-premise with credentials:

<add name="prod" connectionString="Url=http://myserver/AdventureWorksCycle; Domain=mydomain; Username=administrator; Password=password; AuthType=AD;"/>

On-premise IFD before CRM 2016:

<add name="prod" connectionString="Url=https://contoso.litware.com; [email protected]; Password=password; AuthType=IFD;"/>

On-premise IFD for CRM 2016 and later (v8.0+)

<add name="prod" connectionString="ServiceUri=https://contoso.litware.com/contoso; Domain=contoso; Username=contoso\administrator; Password=password; AuthType=IFD; LoginPrompt=Never;" />