Microsoft Knowledge Base Email Alertz

(822456) - This article describes the recommended way to authenticate specific user credentials by using the Microsoft Customer Relationship Management (CRM) Security Model from an external process.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 822456 - Last Review: May 23, 2007 - Revision: 4.12

How to authenticate specific user credentials by using the Microsoft CRM Security Model from an external process

SUMMARY

This article describes the recommended way to authenticate specific user credentials by using the Microsoft Customer Relationship Management (CRM) Security Model from an external process.

MORE INFORMATION

To manually load the CredentialCache method of the client proxy class, you must understand the System.Net.CredentialCache class. For more information, visit the following MSDN Web site:
.NET Framework Class Library - CredentialCache.Add Method
http://msdn2.microsoft.com/en-us/library/system.net.credentialcache.add(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/system.net.credentialcache.add(vs.71).aspx)
Microsoft CRM uses integrated Microsoft Windows authentication to perform authentication. As a result, the following Microsoft C# code loads the CredentialCache method of the Microsoft CRM proxy class on the server where the process that is integrating with Microsoft CRM resides.
{

// Set the name of the server to the name of the Microsoft CRM API Web server.

string server = "CRMWebServer";

// Virtual Directory on the Microsoft CRM API Web server.

string virtualDirectory = "mscrmservices";
string strDir = "http:/" + server + "" + virtualDirectory + "";

// Instantiate a Microsoft CRM BizUser object (Member of Microsoft.CRM.Proxy.dll).

Microsoft.CRM.Proxy.BizUser bizUser = new Microsoft.CRM.Proxy.BizUser ();

bizUser.Url = strDir + "BizUser.srf";

// Instantiate a System.Net.CredentialCache object.

System.Net.CredentialCache credentialCache = new CredentialCache();               

// Instantiate a System.Net.NetworkCredential object passing in the Active Directory UserName,
// Password and Domain that will be used to authenticate into the Microsoft CRM Security Model. 
// Set up this user in Microsoft CRM and give the user the appropriate License Keys and Roles. 

System.Net.NetworkCredential credentials = new System.Net.NetworkCredential +
("User1","Password","Domain");

// Add a value to the CredentialCache to indicate the URI of the Microsoft CRM Server, "NTLM", 
// which represents integrated Windows authenticated and the credentials of 
// the user who is to be used for authentication.

credentialCache.Add(new Uri("http:/" + server), "NTLM", credentials);

bizUser.Credentials = credentialCache;

}

Each time that the Web application has to authenticate to the Microsoft CRM API classes and pass lead data, the application passes the credentials of User 1. When a record is created or updated from the Web application to Microsoft CRM, the CreatedBy field and the LastUpdatedBy field are populated with User 1's credentials.

REFERENCES

For more information about the Microsoft CRM Proxy classes, visit the following MSDN Web sites:
Microsoft CRM SDK
http://msdn2.microsoft.com/en-us/library/aa477293.aspx (http://msdn2.microsoft.com/en-us/library/aa477293.aspx)
Microsoft.CRM.Proxy Namespace
http://msdn2.microsoft.com/en-us/library/aa477376.aspx (http://msdn2.microsoft.com/en-us/library/aa477376.aspx)

APPLIES TO
  • Microsoft CRM Software Development Kit, when used with:
    • Microsoft CRM 1.2
    • Microsoft Business Solutions CRM 1.0
  • Microsoft CRM 1.2
  • Microsoft Business Solutions CRM 1.0
Keywords: 
kbmbsmigrate kbinfo KB822456
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate