Integrating CRM 2011 (on-line) with Windows Azure AppFabric

I just did the same as in my previous post but with the on-line version of CRM. You can then skip all the CRM configuration steps.

The discovery URL to use in the plug-in registration tool is https://dev.crm4.dynamics.com (for Europe).

The issuer name is on the Settings->Customization->Developer Resources page: crm4.dynamics.com (once again for Europe).

Integrating CRM 2011 (on-premise) with Windows Azure AppFabric

One of the new features of CRM 2011 is out-of-the-box integration with the Windows Azure service bus (Windows Azure AppFabric). I tried to test this feature with CTP4 but did not reach a working solution. With the beta, it was relatively easy. The documentation is fairly complete, but some steps are not described in detail. Here is a walk-through.

Configure CRM for Integration with Windows Azure

Obtain a certificate

Create a self-signed certificate and put it in the personal store in local computer:

makecert -n "CN=CRMAzure" -sr LocalMachine -ss My –r

Copy the certificate from Personal to Trusted Root Certification Authorities.

image

Export the public key in Base64 format to e.g. CRMAzure.cer.

Configure Certificate Read Access

Add permission for your CRM service account, in my case Network Service, to access the private key by right-clicking on the certificate and choosing All Tasks -> Manage Private Keys…

image

Configure the CRM Database (MSCRM_Config)

Register the CRM PowerShell cmdlets

On a PowerShell command line, type

Add-PSSnapin Microsoft.Crm.PowerShell

If you get the following error message:

Add-PSSnapin : The Windows PowerShell snap-in ‘Microsoft.Crm.PowerShell’ is not installed on this machine.

You must first install this snap-in by running

C:WindowsMicrosoft.NETFramework64v4.0.30319InstallUtil.exe "C:Program FilesMicrosoft Dynamics CRMToolsMicrosoft.Crm.PowerShell.dll"

When doing that, you might get the following error:

Add-PSSnapin : Cannot load Windows PowerShell snap-in Microsoft.Crm.PowerShell because of the following error: Could not load file or assembly ‘file:///C:Program FilesMicrosoft Dynamics CRMToolsMicrosoft.Crm.PowerShell.dll’ or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

You can fix this by instructing Windows to always use the 4.0 CLR with the following command:

reg add hklmsoftwarewow6432nodemicrosoft.netframework /v OnlyUseLatestCLR /t REG_DWORD /d 1

Set the CRM certificate

On the PowerShell command line, type the following command:

set-crmcertificate -CertificateType AppFabricIssuer -Name <issuerName> -StoreName My -StoreLocation LocalMachine -StoreFindType FindBySubjectDistinguishedName -DataFile <certificateFilename>

In my case:

set-crmcertificate -CertificateType AppFabricIssuer -Name CRMAzure -StoreName My -StoreLocation LocalMachine -StoreFindType FindBySubjectDistinguishedName -DataFile C:UsersAdministratorDocumentsCRMAzure.cer

Register an Azure-aware Plug-in using the Plug-in Registration Tool

Connect to the Microsoft Dynamics CRM Server

Use http://<host&gt;:5555 as discovery URL.

image

Create a Service Endpoint Configuration

image

The solution namespace should match your AppFabric service namespace, which you can look up at appfabric.azure.com.

image

The path should match the path you’re going to use in your listener.

Press Save & Configre ACS.

Configure AppFabric ACS

Here is good news in the beta. Rather than running ACM commands, you can let the plug-in registration tool do the necessary Azure AppFabric security configuration for you.

image

You see your management key at the same web page as your namespace.

Register the ServiceBusPlugin Plug-in for an Event

Now you can go ahead and register the out-of-the-box plug-in for an event. Here I register it for creation of contacts.

image

Create and Compile your Service

Using Visual Studio, create a new Windows console C# project. Copy the sample one-way listener code from the SDK documentation (Advanced Development for Microsoft Dynamics CRM -> Azure Extensions for Microsoft Dynamics CRM ->Sample Code for CRM-AppFabric Integration). Compile and run.

Now you can create a contact and if everything works stuff should be printed on the console after a minute or two.