locked
Crmsvcutil and claim based auth failed to autentificate RRS feed

  • Question

  • Hello,

    I cannot connect with crmsvcutil to my On premise CRM with claim based auth. It ends with error bellow

    Exiting program with exception: The user authentication failed!
    Enable tracing and view the trace files for more information.
    crmsvcutil.exe Error: 0 : Exiting program with exit code 2 due to exception : System.InvalidOperationException: The user
     authentication failed!
       at Microsoft.Xrm.Sdk.ClientExceptionHelper.Assert(Boolean condition, String message)
       at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.AuthenticateCore()
       at Microsoft.Xrm.Sdk.Client.ServiceProxy`1.ValidateAuthentication()
       at Microsoft.Xrm.Sdk.Client.ServiceContextInitializer`1.Initialize(ServiceProxy`1 proxy)
       at Microsoft.Xrm.Sdk.Client.OrganizationServiceContextInitializer..ctor(OrganizationServiceProxy proxy)
       at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
       at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.RetrieveEntities(IOrganizationService service)
       at Microsoft.Crm.Services.Utility.SdkMetadataProviderService.Microsoft.Crm.Services.Utility.IMetadataProviderService.
    LoadMetadata()
       at Microsoft.Crm.Services.Utility.CrmSvcUtil.Run()
       at Microsoft.Crm.Services.Utility.CrmSvcUtil.Main(String[] args)

     

    crmsvcutil /out:entity.cs /url:https://czprgntdv61/ucl/XRMServices/2011/Organization.svc /u:username /d:domain /p:password

    When I try to connect from my app to OrgService it works. When I look at fiddler crmsvcutil request ADFS for WSDL but never request endpoint for authentication.

    I use SDK 5.0.2

    Is there anyone who succcessfully connect to CRM with claim based auth and crmsvcutil?

    Thanks

     

    Thursday, March 17, 2011 1:11 PM

Answers

All replies

  • Have you resolved this? I am having the same issue.
    Thursday, March 24, 2011 1:35 AM
  • Now, but I send mail to author of Filder becouse after some connection to ADFS WSDL fildder crash. Response was that fiddler crash becouse crmsvcutil send malformed request. In this time I have class from pro IFD settings than I use this and changes I do to partial classes :-(
    Thursday, March 24, 2011 2:07 PM
  • I've got the exact same issue. I opened the Crmsvcutil.exe in Reflector and it appears that there is a bug in the Microsoft.Crm.Services.Utility.SdkMetadataProviderService class.

    private ClientCredentials CreateCredentials(IServiceConfiguration<IOrganizationService> orgServiceConfig)
    {
      ClientCredentials credentials = new ClientCredentials();
      if (orgServiceConfig.AuthenticationType != AuthenticationProviderType.LiveId)
      {
        credentials.Windows.ClientCredential = new NetworkCredential();
        credentials.Windows.ClientCredential.UserName = GetValueOrDefault(this.Parameters.UserName, null);
        credentials.Windows.ClientCredential.Password = GetValueOrDefault(this.Parameters.Password, string.Empty);
        credentials.Windows.ClientCredential.Domain = GetValueOrDefault(this.Parameters.Domain, null);
        return credentials;
      }
      credentials.UserName.UserName = GetValueOrDefault(this.Parameters.UserName, null);
      credentials.UserName.Password = GetValueOrDefault(this.Parameters.Password, null);
      return credentials;
    }
     
    

    When using claims authentication the AuthenticationType is AuthenticationProviderType.Federation and due to the if statement windows credentials are used instead. Windows credentials should only be used when the AuthenticationType is AuthenticationProviderType.ActiveDirectory.

    Hopefully Microsoft will fix this soon.

    Wednesday, March 30, 2011 2:56 PM
  • I have the same issue as well!

    J:\HostSites\FilesRoot\SDK\CRM2011\LatestSDK\bin\crmsvcutil.exe /url:https://admissionslab.422g.com/xrmServices/2011/Organization.svc /domain:422g /username:CRM2011Admin /password:****** /namespace:EM.Crm_2011.Xrm.Org /servicecontextname:OrgServiceContext /out:"C:\Hostsites\FilesRoot\Source\dotnet40\422GroupEnterpriseLibrary\AddressVerification\AddressVerificationLibrary\SDK\XRMSchemas\CRM2011\422g\AdmissionsLab\Xrm.cs"

    CrmSvcUtil : CRM Service Utility [Version 5.0.9688.583]

    c 2011 Microsoft Corporation.  All rights reserved.

     

     

    Exiting program with exception: The user authentication failed!

    Enable tracing and view the trace files for more information.

     

    J:\HostSites\FilesRoot\SDK\CRM2011\LatestSDK\bin>

     

    How can I create a data context if this tool cannot even connect! Come on Microsoft!

    Wednesday, March 30, 2011 4:40 PM
  • I have the same issue as well!

     

     

    J:\HostSites\FilesRoot\SDK\CRM2011\LatestSDK\bin\crmsvcutil.exe /url:https://admissionslab.422g.com/xrmServices/2011/Organization.svc /domain:422g /username:CRM2011Admin /password:****** /namespace:EM.Crm_2011.Xrm.Org /servicecontextname:OrgServiceContext /out:"C:\Hostsites\FilesRoot\Source\dotnet40\422GroupEnterpriseLibrary\AddressVerification\AddressVerificationLibrary\SDK\XRMSchemas\CRM2011\422g\AdmissionsLab\Xrm.cs"

     

    CrmSvcUtil : CRM Service Utility [Version 5.0.9688.583]

    c 2011 Microsoft Corporation.  All rights reserved.

     

     

    Exiting program with exception: The user authentication failed!

    Enable tracing and view the trace files for more information.

     

    J:\HostSites\FilesRoot\SDK\CRM2011\LatestSDK\bin>

     

     

    How can I create a data context if this tool cannot even connect! Come on Microsoft!

    Wednesday, March 30, 2011 4:43 PM
  • When I removed the domain parameter I got a different error message

     

    CrmSvcUtil : CRM Service Utility [Version 5.0.9688.583]

    c 2011 Microsoft Corporation.  All rights reserved.

     

     

    Exiting program with exception: The logon attempt failed

    Enable tracing and view the trace files for more information.

     

    J:\HostSites\FilesRoot\SDK\CRM2011\LatestSDK\bin>

    Wednesday, March 30, 2011 4:48 PM
  • Same issue here for our claim based IFD CRM 2011 as well.

     

    The user authentication failed!

     

    Please fix it soon. Microsoft. Thanks.

     

     


    Thursday, March 31, 2011 9:35 PM
  • Today I search for something and found that on download page is new version of SDK. It's same 5.0.3 version but publisched date is in april. When I download and try crmsvcutil it works.

    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=420f0f05-c226-4194-b7e1-f23ceaa83b69

    • Marked as answer by McMlok Thursday, April 7, 2011 9:35 AM
    Thursday, April 7, 2011 9:35 AM
  • I'm working on MSCRM 2011 with IFD.

    When i'm trying to use the CrmSvcUtil It's still not working for me even that i"ve downloaded the latest sdk.

    Please advice..

    • Proposed as answer by vel1 Monday, May 16, 2011 2:41 AM
    • Unproposed as answer by vel1 Monday, May 16, 2011 2:41 AM
    Tuesday, April 26, 2011 11:50 AM
  • You definitely want to read this:

    Claims-based Authentication Workaround for SDK Version 5.0.3 (http://community.adxstudio.com/Default.aspx?DN=9a7499fb-4e9a-408c-8096-6d658f9509a2)

    It did the trick for me!



    • Proposed as answer by vel1 Monday, May 16, 2011 2:43 AM
    • Marked as answer by McMlok Tuesday, May 31, 2011 6:04 AM
    Monday, May 16, 2011 2:43 AM
  • That worked!!! Thanks a lot!!
    Thursday, May 19, 2011 10:24 PM
  • Claims-based Authentication Workaround for SDK Version 5.0.3 (http://community.adxstudio.com/Default.aspx?DN=9a7499fb-4e9a-408c-8096-6d658f9509a2)
    That worked!!! Thanks a lot!!

    Actually, authentication worked but when I looked at generated file I could see entities were missing. But, good people from Adx studio refixed the fix and it is really working now. Be sure you are using code with:

    _metadata = new OrganizationMetadata
    					{
    						Entities = RetrieveEntities(service),
    						OptionSets = RetrieveOptionSets(service),
    						Messages = RetrieveMessages(service),
    					};

    and

    private static SdkMessages RetrieveMessages(IOrganizationService service) {...}

    (parts in bold have been added recently to the article)


    • Proposed as answer by vel1 Monday, May 30, 2011 4:46 PM
    • Unproposed as answer by vel1 Monday, May 30, 2011 4:46 PM
    Wednesday, May 25, 2011 3:21 PM
  • crmsvcutil (build 5.0.9688.1155) in SDK 5.0.4 doesn't seem to fix this issue. It's rather annoying because I'm trying to use linqpad (with the CRM 2011 plugin), and it launches crmsvcutil from within linqpad to refresh the schema, so I don't really have a way to inject those arguments. Anyone have a good workaround for that? I've tried writing a launcher app (which masquerades as crmsvcutil.exe) with little success.

    Thursday, June 9, 2011 1:39 AM
  • I'm trying to use early bound code in plugins.  I tried the adxstudio workaround and got much further.  However, I also needed to reduce the generated file size and so incorporated "Filtering Generated Entities with CrmSvcUtil" (http://erikpool.blogspot.com/2011/03/filtering-generated-entities-with.html).  I'm not sure if this additional fix is the issue but I'm now experiencing the issue described in the following post when my plugin executes:

    Has anyone seen this?  I can't seem to resolve this problem per the suggested remedy.

    I've given up on using early bound code in my plugins for now.  I'm also surprised that this remains an issue even after Update Rollup 2.

    Thanks,

    XRM2011User

     

     

    Wednesday, July 6, 2011 11:50 AM
  • I was facing this problem now trying to connect my console app to crm 2011, I changed in my web.config, the connection string from:

    <add name="Xrm" connectionString="Server=https://yy.yy.com; Domain=myDomain; Username=myUser; Password=myPass"/>

    to:

    <add name="Xrm" connectionString="Server=https://yy.yy.com; Username=myDomain\myUser; Password=myPass"/>

    And worked well.

    Monday, May 20, 2013 8:41 AM