Thursday, 10 July 2014

CRM 2013 Exchange Synchronization

Untill version 2013 of Dynamics CRM we had two ways to processing incoming and outgoing email on CRM:
  • CRM Email Router
  • CRM Outlook Client
With Dynamics CRM 2013 the Asynchronous service now provides server-side Exchange Synchronization so there is no need for the old component, even due they are still exists. The Exchange Synchronization allowing users to:
  • Process outgoing emails
  • Process incoming emails
  • Synchronize contacts, tasks and appointments
  • Automatically tracking emails based on Correlation rules (smart matching or/and tracking token)
On this post I will walk-through how to set up Exchange synchronization with Dynamics CRM 2013, here is an overview of the steps:
  1. Set up an IIS self-signed certificate (it requires SSL)
  2. Configure Exchange Impersonation
  3. Create and configure a CRM 2013 Exchange profile
  4. Configure User Mailboxes
  5. Configure CRM global Email Settings
  6. Test synchronization
  7. Design Overview
  8. known issues
  9. Summary and References
Before we start configuring CRM 2013 with exchange we need to have in-place HTTPS. We just need a self-signed certificate generated by IIS to get us going.

Step 1 :
  Self-signed Certificate To generate the certificate open IIS and highlight the server name and double click Certificates
  • On the right-hand side click on Self-signed certificate
  • Give it a Name (I call it MyCertificate) leave Personal and click OK
  • You should see the certificate listed on the list:
  • Next step is to bind the Dynamics CRM website to HTTPS (443) Highlight the Dynamics CRM web site under sites and on the right-hand side chose Bindings. The below window opens and on the type field you choose HTTPS  this will enable the SSL certificate field to choose a certificate and we choose the MyCertificate, click OK

Step 2: Exchange Account Impersonation
Before we start Configuring profiles in CRM we want to make sure CRM service account has impersonation rights on the Exchange side to do this we run the following PowerShell command: Exchange 2010 New-ManagementRoleAssignment -Name “” -Role:ApplicationImpersonation -User “<service_account>” For example: New-ManagementRoleAssignment -Name “CRM ExServiceAcc” -Role:ApplicationImpersonation -User crm13.service Exchange 2007 Get-MailboxServer “<mailbox_server_name>” | Add-AdPermission -User “<service_account>” -AccessRights ExtendedRight -ExtendedRights ms-Exch-EPI-May-Impersonate, ms-Exch-EPI-Impersonation The second PowerShell command requires the Distinguished Name (DN) of the Microsoft Client Access Server (CAS).   To enable impersonation rights on a single Microsoft CAS server use the following command:   Get-ClientAccessServer -Identity “<cas_server_name>” | Add-AdPermission -User “<service_account>” -ExtendedRights ms-Exch-EPI-Impersonation
Step 3 :
Configuring CRM Exchange Profile With the https binding in-place navigate to CRM using https://server/organization and settings > Email Configuration Click on Email Server Profiles and then New Exchange Profile:
Fill in the details as per the below screenshot, you could use auto-discovery if it’s working okay for you, I have tested in my environment and worked perfectly. The service account we specified has been given server-wide impersonation. I’ve named the profile UK Mailboxes if you have users across different countries and exchange servers located on these sites you should create multiple profiles with the corresponding Exchange servers.
Leave the Advanced settings as they are:   Navigate to Mailboxes and on the Ribbon choose Add Existing Mailbox, by default every user created or imported during an organization import it’s automatically generated a mailbox in the system, so when you click add existing mailbox the system will list all available user accounts.

 Step 4 :
Configuring Mailboxes At this stage we have created an Email Server Profile and added 2 mailboxes, lets double click on one of the mailboxes: Change the: Server Profile: UK Mailboxes (the profile we just created) Incoming Email: Server-Side Synchronization or Email Router Outgoing Email: Server-Side Synchronization or Email Router Note: on the configuration test results you should see Not Run instead of Success the screenshot was taken after the configuration was completed
Approve the Email and then click on Test & Enable Mailbox: You then get the following alert message on the mailbox profile:
Click on Alerts and in a few seconds you will see the following messages coming up:
This means all checks completed successfully and you ready to test it in Outlook. If you look back at the Mailbox General tab you should now see the Configuration test results as Success. During this test a test email is sent to your Inbox: This is a test message to check the outgoing email configuration for [User].
Step 5 :
CRM Global Email settings Before we start the Outlook test, lets first look at the CRM Global Email settings navigate to: Settings > Administration > System Settings Go to the Email Tab, on this section there are a number of important settings that you should think from a design phase rather than implementation. Configure email processing: here you define which default method you want to process users email as it says if you choose Server-Side it will block Email Router. As we want to test server-side synchronization choose server-side instead of Email router. Configure default synchronization method: This will define users profile preferences and this is very important from a design perspective because will avoid duplicating work. If all your users are in UK you can default a server profile to UK Mailboxes, if you have users across different countries you could still define a default Email Server Profile using auto-discovery and then workout manually any specific users that require a manual Server Profile. On the incoming, outgoing email and appointments, contacts and tasks default this to Server-Side synchronization or Email Router this will make sure it can use both.
Below you define if you should only process emails for approved users, this means if email processing is not a sensible subject in your implementation then I would recommend you untick this boxes because it removes an extra click on the configuration steps as we have seen above.

Step 6 : Test Synchronization
You ready to test the exchange synchronization create one appointment in CRM and include as required yourself and another CRM user fill in the other details and SAVE in a few minutes if all works well a meeting request is received in Outlook by all users.
To test sending emails confirm that on the Configure Email processing in the Global email settings is set to server-side synch, send an email to someone from CRM and ask that person to reply back, you should see the email tracked automatically in CRM.