web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

User Authentication Failed when connecting to CRM2013 from C# application

(0) ShareShare
ReportReport
Posted on by 5

I am not able to connect to CRM 2013 from C# application, getting user authentication failed, however the same code is working fine from another system which has SDK installed. Do we need to install SDK?

ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential("*******, "******", "domain");
using (var serviceProxy = new OrganizationServiceProxy(new Uri(SoapOrgServiceUri), null, credentials, null))
{
serviceProxy.Authenticate();
_service = (IOrganizationService)serviceProxy;

}
}

I have the same question (0)
  • Suggested answer
    sdfasdf Profile Picture
    842 on at

    Hi,

    The recommended way to connect to CRM using SDK is by using a connection string with the CrmServiceClient class. Here's a useful article that describes how to use this approach: docs.microsoft.com/.../use-connection-strings-xrm-tooling-connect

    I would also recommend you to use NuGet to download the SDK assemblies for CRM 2013 (version 6.*)

    As far your scenario, I think this would be the code you might want to experiment with:

    var connectionString = "AuthType=AD; Url=http://server:5555/OrgName; Username=user; Password=pwd; Domain=domain";

    using (var client = new CrmServiceClient(connectionString))

    {

       if (!client.IsReady)

       {

           throw new ApplicationException("Unable to connect to CRM. Please check your connection string.");

       }

       var organizationService = (IOrganizationService)client;

       // work with organizationService

    }

    If that does not work, then my recommendation is to start troubleshooting the error message you get. Please feel free to share the error message if this approach doesn't work for you.

    I hope it helps!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 85 Super User 2026 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#3
11manish Profile Picture

11manish 64

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans