Monday, August 6, 2012

UserName cannot be null error message while connecting CRM 2011 Developer toolkit to CRM Office 365 online


Recently I had a need to create a simple plugin that works with a CRM online setup. If you are not aware yet, the CRM Developer toolkit it a great way to easily create code, and automatically deploy that code to CRM from within visual studio itself. The Developer toolkit for Microsoft Dynamics CRM 2011 was released as part of UR5 SDK release and is available for download here.
Once extracted, install the toolkit located in folder \sdk\tools\developertoolkit.

Here are a few things that are available once the toolkit is installed:

  • The Toolkit supports the end-to-end create, update, delete and deployment of CRM Plug-ins, Workflows (both XAML and custom workflow activities), Silverlight applications and other Web resources; including Jscript and HTML.
  • Easily generate strongly typed proxy classes without having to run CrmSvcUtil.exe.
  • Works with Dynamics CRM Online, On-premise AD and IFD deployments.

The focus of this post is the last line item, specifically working with CRM online deployments. While going through the steps to create a new project based on the Dynamics CRM Template, you will see a dialog that establishes the connection with the CRM Server. After entering the discovery server name and clicking connect, the Authentication Details section gets enabled.


































While trying to authenticate with my Office 365 CRM online user ID and password, I get an error message:
"Value cannot be null. Parameter name: ClientCredentials.UserName.UserName"












Tip: The CRM Discovery Server Name is "disco.crm.dynamics.com" for Office 365 ids and "dev.crm.dynamics.com" for users with Live Id. If you have CRM on a server, enter the name of the server for the Server Name field.


I tried a few different combinations, but could not get over this error message. I ended up creating the plugin the old fashioned way - a class library project from Visual Studio. Note that just last month I had connected to a CRM Server that was an on-premise install without a problem.

This issue seems to be isolated to user id's created from Office 365, which is in the format <name>@<organization>.onmicrosoft.com. If you have access to MS Connect, you will notice that there are open issues which talk about a similar problem.

I will try to update this post on any new developments to this issue. If anyone has had success with establishing the connection, please let me know and I will publish their findings.

Hope this post helps someone save some time when facing the same issue I did!

Update: See the comment from Abhishek for a possible fix. "use the recent developer toolkit , remove the previous one from the v.s. and then install the recent developer tool kit . it works and authenticates." Thanks Abhishek!

4 comments:

  1. Hello,

    i'm experiencing the same issue as this post was released 4 months ago.

    Is there any update?

    Thanks in advance

    ReplyDelete
  2. So with version 1.1 of this toolkit I can now authenticate with an O365 account, but I'm still unable to use any AD FS 2.0 user authentication.

    ReplyDelete
  3. use the recent developer toolkit , remove the previous one from the v.s. and then install the recent developer tool kit .
    it works and authenticates.

    ReplyDelete
  4. Thank you for the response Abhisekh.
    To pad out the detail, you definately have to uninstall the existence of the DevToolkit from Windows. By running the original installer you get the Repair/Remove option. Worst case scenario, install the new one, remove it, then reinstall. An install over the top didn't work for my VS2010, the removal was key!
    Another step which I have seen others mention in posts is the removal of the Live ID XML file from C:\Users\{your UesrID}\LiveDeviceID

    ReplyDelete