Back in November I released the first version of the Data8.PowerPlatform.Dataverse.Client NuGet package to let developers connect to on-prem Dynamics CRM/365 instances using claims-based or IFD authentication without having to configure OAuth.
I’ve now released an update to this package – version 2.0.0 also includes support for Active Directory (AD) authentication too!
You can continue to use this package in exactly the same way as before – give it the URL of the organization service and the username and password to authenticate as, and you get back a standard
IOrganizationService instance you can use in exactly the same way as the standard Microsoft SDK.
var svc = new OnPremiseClient("https://crm.contoso.com/org/XRMServices/2011/OrganizationService.svc", "AD\\username", "password"); var qry = new QueryExpression("contact"); qry.Criteria.AddCondition("firstname", ConditionOperator.Equal, "Mark"); qry.Criteria.AddCondition("lastname", ConditionOperator.Equal, "Carrington"); var results = svc.RetrieveMultiple(qry);
You can also authenticate as the currently logged in user by leaving the username and password parameters set to
OnPremiseClient class will automatically detect whether the instance you’re connecting to supports claims based authentication or Active Directory authentication.
NOTE: Active Directory authentication will only work when the client is running on Windows. If you need it on Linux and are familiar with the GSS API, please get in touch!
I’ve tested this library on the on-prem servers I have available, but if there’s one thing I’ve learned working with on-prem is that there’s a huge range of ways that they end up being configured – not all of them correct/supported. If you do have any problems authenticating with this library I’d love to hear about it so I can update it as necessary for other configurations.