locked
how to use authentication in crm 2011?? RRS feed

  • Question

  • Can anyone please tell me how to create authentication in crm 2011???
    Monday, July 18, 2011 4:28 PM

Answers

  • ok, now your question makes a whole lot more sense to me :)

    for plugin's (within the app execution pipeline) you can use something like this.

    http://mileyja.blogspot.com/2011/04/instantiating-service-object-within.html

    For external apps the best way to do it is to look at either the plugin registration tool in the tools folder of the SDK or the soaplogger solution in the samplescode/cs/client folder to see how those solutions are instantiating an organization service object and copy and emulate the methodology.  This has been my methodology for many applications.  There is an included crmhelpers.cs file that is used by many of the solutions in the SDK that has all the correct code you need.  You will need to generate an SDK proxy with crmsvcutil.exe to get any custom types that you don't want to use dynamic types (Entity, which was dynamicentity in CRM 4.0) for.

    Again as stated above, the SDK can be downloaded at http://www.microsoft.com/download/en/details.aspx?id=24004

     


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, July 19, 2011 2:19 AM
    Moderator
  • The code is just different.

    For external apps the best way to do it is to look at either the plugin registration tool in the tools folder of the SDK or the soaplogger solution in the samplescode/cs/client folder to see how those solutions are instantiating an organization service object and copy and emulate the methodology.  This has been my methodology for many applications.  There is an included crmhelpers.cs file that is used by many of the solutions in the SDK that has all the correct code you need.  You will need to generate an SDK proxy with crmsvcutil.exe to get any custom types that you don't want to use dynamic types (Entity, which was dynamicentity in CRM 4.0) for.

    Again as stated above, the SDK can be downloaded at http://www.microsoft.com/download/en/details.aspx?id=24004


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, July 19, 2011 3:24 PM
    Moderator
  • Hi Senthil,

     The way we are connecting to CRM Web services is slightly different. According to me  the closest thing to CrmAuthenticationToken to is 

    IServiceConfiguration

    Here is sample code from SDK first you retrieve the CurrentOrganizationDetail from discovery service

    then use the following code to connect to the Organization service.

    Uri orgServiceUri = new Uri(CurrentOrganizationDetail.Endpoints[EndpointType.OrganizationService]);

     

                IServiceConfiguration<IOrganizationService> orgConfigInfo =

                                ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(orgServiceUri);

     

                var creds = new ClientCredentials();

                OrgService = new OrganizationServiceProxy(orgConfigInfo, creds);

                var osp = OrgService as OrganizationServiceProxy;

     

                WhoAmIRequest req = new WhoAmIRequest();

                var response = OrgService.Execute(req) as WhoAmIResponse;

     

    I hope this helps.


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    Monday, August 15, 2011 12:59 AM

All replies

  • It's built in and integrated with active directory.  It is seamless so you don't see it many times because the user is already logged into their computer, but each user you add in CRM will have roles and privileges attached to them  The only other option is ADFS claims-based authentication if you set up an Internet Facing Deployment.

     


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Monday, July 18, 2011 4:59 PM
    Moderator
  • In crm 4.0 we are using CrmAuthenticationToken class to connect the database. I don't see this option in crm 2011. Can you please tell what should i use to connect database. thanks.
    Monday, July 18, 2011 5:24 PM
  • You shouldn't be hitting the database directly.  There are built in web services for this purpose.  I think you should review the SDK and the enclosed .CHM file for documenation and also look at the code samples included.

    http://www.microsoft.com/download/en/details.aspx?id=24004


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Monday, July 18, 2011 8:51 PM
    Moderator
  • Hi,

    Sorry, To authenticate the user in crm 4 on-permises edition we will use this code

    CrmAuthenticationToken token = new CrmAuthenticationToken();

    token.authenticationtype=0;

    token.Organizationname="Test";

    CrmService crm = new crmservice();

    crm.url="CrmURl";

    crm.CrmAuthenticationTokenvalue=token;

    crm.credentials=system.Net.Credentialcache.Defaultcredential;

    for this what should I use in crm 2011?. Thanks.

    Tuesday, July 19, 2011 2:09 AM
  • ok, now your question makes a whole lot more sense to me :)

    for plugin's (within the app execution pipeline) you can use something like this.

    http://mileyja.blogspot.com/2011/04/instantiating-service-object-within.html

    For external apps the best way to do it is to look at either the plugin registration tool in the tools folder of the SDK or the soaplogger solution in the samplescode/cs/client folder to see how those solutions are instantiating an organization service object and copy and emulate the methodology.  This has been my methodology for many applications.  There is an included crmhelpers.cs file that is used by many of the solutions in the SDK that has all the correct code you need.  You will need to generate an SDK proxy with crmsvcutil.exe to get any custom types that you don't want to use dynamic types (Entity, which was dynamicentity in CRM 4.0) for.

    Again as stated above, the SDK can be downloaded at http://www.microsoft.com/download/en/details.aspx?id=24004

     


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, July 19, 2011 2:19 AM
    Moderator
  • Hi Jamie,

    Thanks for your reply. I amn't asking for Plugin. If I wanna use the Entity (Account, Contact etc...)  in Vs Studio 2008 and want to get the url,username, password and which type of authentication we wanna choose(windows or live or IFD) right. For that we are using this code

    CrmAuthenticationToken token = new CrmAuthenticationToken();

    token.authenticationtype=0;

    token.Organizationname="Test";

    CrmService crm = new crmservice();

    crm.url="CrmURl";

    crm.CrmAuthenticationTokenvalue=token;

    crm.credentials=system.Net.Credentialcache.Defaultcredential;

    how can i use this code in crm 2011. Once again thanks for your reply.

    Tuesday, July 19, 2011 3:20 PM
  • The code is just different.

    For external apps the best way to do it is to look at either the plugin registration tool in the tools folder of the SDK or the soaplogger solution in the samplescode/cs/client folder to see how those solutions are instantiating an organization service object and copy and emulate the methodology.  This has been my methodology for many applications.  There is an included crmhelpers.cs file that is used by many of the solutions in the SDK that has all the correct code you need.  You will need to generate an SDK proxy with crmsvcutil.exe to get any custom types that you don't want to use dynamic types (Entity, which was dynamicentity in CRM 4.0) for.

    Again as stated above, the SDK can be downloaded at http://www.microsoft.com/download/en/details.aspx?id=24004


    Jamie Miley
    Check out my about.me profile!
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Tuesday, July 19, 2011 3:24 PM
    Moderator
  • Hi Senthil,

     The way we are connecting to CRM Web services is slightly different. According to me  the closest thing to CrmAuthenticationToken to is 

    IServiceConfiguration

    Here is sample code from SDK first you retrieve the CurrentOrganizationDetail from discovery service

    then use the following code to connect to the Organization service.

    Uri orgServiceUri = new Uri(CurrentOrganizationDetail.Endpoints[EndpointType.OrganizationService]);

     

                IServiceConfiguration<IOrganizationService> orgConfigInfo =

                                ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(orgServiceUri);

     

                var creds = new ClientCredentials();

                OrgService = new OrganizationServiceProxy(orgConfigInfo, creds);

                var osp = OrgService as OrganizationServiceProxy;

     

                WhoAmIRequest req = new WhoAmIRequest();

                var response = OrgService.Execute(req) as WhoAmIResponse;

     

    I hope this helps.


    Amreek singh Senior CRM Consultant CDC Praxa Sydney,Australia http://mscrmshop.blogspot.com/
    Monday, August 15, 2011 12:59 AM
  • Sunday, February 19, 2012 12:49 AM
    Moderator