Skip to main content

Notifications

Announcements

No record found.

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;

}
}

  • Suggested answer
    sdfasdf Profile Picture
    840 on at
    RE: User Authentication Failed when connecting to CRM2013 from C# application

    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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 99

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans