Anyone who has attempted to configure Dynamics CRM 2011 with an Internet-Facing Deployment (IFD) knows that it is no trivial task. Where there are blog posts that discuss setting up an IFD, and Microsoft documentation for configuring the IFD, they often assume that ADFS and Dynamics CRM are installed on the same server, and that there is only one Dynamics CRM front-end server. Unfortunately, real-world implementations don’t always follow that.
For example, take the following configuration:
- a Dynamics CRM front-end server on the internal network, providing services to internal clients
- a Dynamics CRM front-end server in an Internet-facing zone, providing services to external clients
- a separate ADFS server accessible to internal and external clients
Dynamics CRM with IFD requires a combination of ADFS relaying party trusts and DNS configuration to get things working. One caveat with IFDs is that the internal and external host names for the Dynamics CRM front-end servers must be different because, externally, the host name includes the CRM organization name. Where, internally, you may have https://icrm.contoso.com/crm, externally you would have https://crm.contoso.com.
Let’s flesh out our sample implementation and requirements:
- icrm.contoso.com is our internal Dynamics CRM front-end server, accessible only on the internal network
- ecrm.contoso.com is our external Dynamics CRM front-end server, accessible to our internal network and the public Internet
- adfs.contoso.com is our ADFS server, accessible to our internal network and the public Internet
- We have two Dynamics CRM organizations: CRM and CRM-Test.
- We want our internal and external (public Internet) clients to access CRM using the same URLs: crm.contoso.com and crm-test.contoso.com. In other words, we don’t want the two-URL problem outlined above.
The last bit has nothing to do with Dynamics CRM: it is all done in IIS. Let me explain how.
IFD Host Names and DNS Configuration
In order to get Dynamics CRM configured for the IFD, your internal DNS and external DNS must be set as needed to allow internal and external clients to resolve to all Dynamics CRM and ADFS host names.
One poorly-documented part of the IFD setup is what the host names should point to in the Internet Facing Deployment Configuration Wizard. The Discovery Web Service Domain (something like dev.contoso.com) and the “external domain where your Internet-facing servers are located” (something like auth.contoso.com) must both resolve to a Dynamics CRM front-end server, not the ADFS server. Be sure to set up these host names to resolve to your internal/external Dynamics CRM servers.
So, in our sample environment, our internal and external DNS has the following entries:
- contoso.com zone:
- icrm (internal DNS only)
- ecrm (internal and external DNS)
- adfs (internal and external DNS)
- auth (internal and external DNS, points to icrm internally and ecrm externally)
- dev (internal and external DNS, points to icrm internally and ecrm externally)
- crm (internal and external DNS, points to ecrm internally and externally)
- crm-test (internal and external DNS, points to ecrm internally and externally)
The DNS configuration, if wrong, at best, will break your IFD, and at worst break all access to Dynamics CRM, so be sure to get it right. If you get it right, and you configure the IFD right, your setup would work as follows:
- Internal clients access CRM at https://icrm.contoso.com/CRM and https://icrm.contoso.com/CRM-Test. No ADFS authentication is required.
- External clients access CRM at https://crm.contoso.com and https://crm-test.contoso.com. ADFS authentication is required.
This unfortunately is not what we want. Instead, we want our users to use the external client domains whether they are internal or external. To do this requires no change to Dynamics CRM; rather, the solution is through Internet Information Services (IIS).
Rewriting URLs with IIS
Here’s what happens with the above configuration:
- User enters https://crm.contoso.com or https://crm-test.contoso.com in their browser.
- The request is sent to the internal Dynamics CRM server, icrm.contoso.com.
- Dynamics CRM calls ADFS to get credentials for the user.
- ADFS can’t resolve the user’s credentials, because the host name is not known to ADFS.
- User can’t access Dynamics CRM.
Here’s what needs to happen:
- User enters https://crm.contoso.com or https://crm-test.contoso.com in their browser.
- The request is sent to the internal Dynamics CRM server, ecrm.contoso.com.
- IIS and the URL Rewrite module running on ecrm.contoso.com examine the request and identifies it as coming from an internal client (by IP address).
- If the request is coming from an internal client, IIS redirects the client to https://icrm.contoso.com/crm or https://icrm.contoso.com/crm-test.
- Everything else works as expected.
URL Rewriting rules live in the web.config file in the Dynamics CRM installation directory (by default, C:\Program Files\Microsoft Dynamics CRM\CRMWeb). Open this file and add the following to the <rules> section.
The only changes you need to make to the above are:
- Change the regular expression pattern in the REMOTE_ADDR line to match your internal IP addresses. (Google has a nice tool to help with this.)
- Change the url in the Redirect line to match the host name of your internal Dynamics CRM server.
Do that, test it extensively (internally and externally), and then tell your users that the one URL they use to access Dynamics CRM is the only one they need to remember.
Leave a reply to Ritesh Cancel reply