How to Connect to CRM 2015 Online from Windows Azure Worker Role RRS feed

  • Question

  • I am just getting started with Worker Role where I need to connect to CRM 2015 Online to do additional processing. 

    Can some please guide me with same code/project that will make a connection and then I can use the CRM SDK to make those calls. 

    Friday, June 5, 2015 1:18 PM

All replies

  • I'm not sure if it has exactly what you're looking for, but the CRM SDK has Azure examples in its library.  I'd check there first.

    The postings on this site are solely my own and do not represent or constitute Hitachi Solutions' positions, views, strategies or opinions.

    Friday, June 5, 2015 3:39 PM
  • I am looking for code that will make a Connection to a CRM online instance and do some further processing. i.e. I need a worker role that will run every few minutes and check for a status and do further operation.

    Friday, June 5, 2015 4:07 PM
  • And prefer to you use an Xrm class so I can use Early Bound classes. Where do I store the CRM Connection information etc?
    Friday, June 5, 2015 4:08 PM
  • If you are going to use early bound classes then you either need to use the webservice or use the CRM SVC utility.

    Info on using the CRM SVC util.


    Check out this project in the SDK, it should help you with the connection, it has information on all the CRUD(Create, Retrieve, Update, Delete) operations.


    This link might also help you regarding the quickstart project


    Halldór Jóhannsson

    Friday, June 5, 2015 4:31 PM
  • So I have included the 7.0 version of the CRM SDK but when I try to build I get the following. In order for me to compile the SDK I need to targeted .NET Version 4.5.2.

    Error 1 The role WorkerRole1 is using an unsupported TargetFrameworkVersion v4.5.2. c:\users\myworkstation\documents\visual studio 2013\Projects\AzureCloudService3\AzureCloudService3\bin\Debug\ServiceDefinition.csdef 1 1 AzureCloudService3

    Friday, June 5, 2015 6:05 PM
  • Yeah you need to install .net 4.5.2 and set that version in visual studio for your project.

    Halldór Jóhannsson

    Friday, June 5, 2015 6:13 PM
  • I have 4.5.2 installed on my machine I am getting that message when I try to build WorkerRole Project which now is targeting 4.5.2. Can WorkerRole not target .NET 4.5.2?

    Friday, June 5, 2015 6:16 PM
  • Sadly I do not know much about WorkerRole, supposedly it does not support 4.5.2 yet, can you try to compile your code with .net 4.5.1? if that fails you could try and use the CRM 2013 SDK DLLs (6.0 if I remember) with an even lower .net version, CRM 2015 should support that. 

    Halldór Jóhannsson

    Friday, June 5, 2015 6:22 PM
  • So I downgraded to include the CRM 2013 SDK on the Worker Role Project once I include any of the CRM SdK code. I start seeing the following

    Error 1 'Task' does not contain a definition for 'Wait' and no extension method 'Wait' accepting a first argument of type 'Task' could be found (are you missing a using directive or an assembly reference?) C:\Users\mymachine\Documents\visual studio 2013\Projects\AzureCloudService3\WorkerRole1\WorkerRole.cs 29 67 WorkerRole1





    // TODO: Replace the following with your own logic.










    varconnectionstring = RoleEnvironment.GetConfigurationSettingValue("CRMConnection");


    CrmConnectionconnection = CrmConnection.Parse(connectionstring);


    using(_orgService = newOrganizationService(connection))



    Guiduserid = ((WhoAmIResponse)_orgService.Execute(newWhoAmIRequest())).UserId;


    SystemUsersystemUser = (SystemUser)_orgService.Retrieve("systemuser", userid,


    newColumnSet(newstring[] { "firstname", "lastname"}));


    Trace.TraceInformation("Logged on user is {0} {1}.", systemUser.FirstName, systemUser.LastName);




    Friday, June 5, 2015 7:56 PM
  • I cannot any of the CrM SDK working with Windows Azure Worker Role. Has anyone done this out there. Can you please provide some sample code.
    Friday, June 5, 2015 8:22 PM
  • It looks like the Early bound class does not work with Windows Azure Worker Role. I do not seem to get it to work.
    Friday, June 5, 2015 9:01 PM
  • There might be a conflict between the CRM 2013 DLLs and the SVC utils code extracted from crm 2015, have you tried using late bound?

    You might also be able to go into the code you extracted with the SVC utils and remove the wait part from Task

    Halldór Jóhannsson

    Friday, June 5, 2015 10:49 PM