Search code examples
dynamics-crm-2011dynamics-crmclaims-based-identity

Dynamics CRM 2011: Using CrmSvcUtil.exe with IFD Claims Based Authentication


We have a single server development environment of Dynamics CRM 2011 with IFD + Claims Based Authentication setup.

Struggling to run the CrmSvcUtil command without getting the following 'Access is denied' error. We are running the util as an administrator, who is also a System Administrator in Dynamics CRM 2011.

Command we are running is:

CrmSvcUtil.exe /url:https://myorg.deepspace9.com:444/myorg/XRMServices/2011/Organization.svc /out:MyOutputFile.cs /username:"deepspace9\administrator" /password:password*1

And we end up getting the error:

CrmSvcUtil : CRM Service Utility [Version 5.0.9690.2165]
c 2011 Microsoft Corporation.  All rights reserved.

CrmSvcUtil.exe Error: 0 : Exiting program with exit code 2 due to exception : System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.

Server stack trace: 
   at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request)
   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)

We've also tried running the instructions at: http://community.adxstudio.com/products/adxstudio-portals/developers-guide/knowledge-base/crmsvcutilexe/claims-based-authentication-workaround-for-sdk-ver/

Any ideas?


Solution

  • Managed to get it working. Followed the instructions at http://blog.thinketg.com/blog/ben-klopfer/strongly-typed-code-file-generation-with-crmsvcutilexe-for-crm-2011-ifd-configurations-code

    I had to run HTML decoding to get rid of the HTML tags and I didn't bother creating the batch file - I just ran the command directly:

    CrmSvcUtil.exe /metadataproviderservice:"MetadataProvider.IfdMetadataProviderService, MetadataProvider" /codecustomization:"Microsoft.Xrm.Client.CodeGeneration.CodeCustomization, Microsoft.Xrm.Client.CodeGeneration" /url:"https://myorg.deepspace9.com:444/XRMServices/2011/Organization.svc" /out:"outputOrganizationXrm.cs" /namespace:OrganizationXrm /serviceContextName:XrmServiceContext /serviceContextPrefix:Xrm /u:"deepspace9\administrator" /p:password*1