In one of my LAST articles I have described the MX-Records and the SPF-Records, how they work and why we need them. In this article I would like to tell you more about Autodiscover, CNAME and A-Records. Why we need them and which DNS category is needed for what.
Note, there are more kind of records than those I am going to describe here, they also can be used for more functions than the examples I am writing here in this article.
Autodiscover:
Autodiscover is still one of the key functions which is needed for Outlook, Skype for Business, Smartphones and also other services to find their way to the Exchange environment. The first time we saw Autodiscover in the Exchange world was with the Exchange version 2007. However, nowadays we are going more and more to the cloud or we start using Exchange in a hybrid configuration. In this case we simply use the Office 365 record which looks like this:
Host: autodiscover Type: CNAME Address: autodiscover.outlook.com
However, the goal of this article is to understand Autodiscover, so let us have a closer view on it now:
So let us have a look how Autodiscover works…
1) The Outlook Client sends a LDAP query to our Active Directory to get SCP Points.
2) Outlook then sorts the SCP records and creates one list – either in-site or out-of-site (site is determined based on the client machine’s AD site) This list will be sorted bei install order.
3) Our Outlook Client will sort now the connection points which were received from the previous request and sends a HTTPS DNS Request to the Autodiscover URL derived from the SCP. If this fails AutoD will fallback to four DNS queries in the following order
- Connect to: https://contoso.com/AutoDiscover/AutoDiscover.xml
- Connect to: https://autodiscover.contoso.com/AutoDiscover/AutoDiscover.xml
- Autodiscover redirect URL for redirection: http://autodiscover.contoso.com/autodiscover/autodiscover.xml
- Search for DNS SRV record
If that fails to, the connection will fail and we will receive an error on the screen.
4) However, if Autodiscover is configured correctly, it will return with the service connection settings to the Outlook Client with a XML respoonse. This XML Response contains all connection settings.
Now our Outlook Client will take all these configuration information to contact our Exchange server environment. The Exchange server will check for the appropriate mailbox information for the configuration information provided by the Outlook client.
Here a short Pingback to the Point 2, below you can see how this XML Response looks like:
Outlook is now connected by using Autodiscover to our Mailbox. Let us have now a short view about the SCP connection points. SCP(Service connection point) are created by the Exchange server itself and they are visible in our Active Directory. So if we use the ‘Active Directory Sites and Services’ Snipin, we can see the SCP:
The Outlook Providers contains all the Exchange server Autodiscover information. The actual Autodiscover response will be calculated from these and the Virtual directory settings.
If we want to find out the virtual directory that it is responsible for the Autodiscover service, we can chose between two ways. The quick way is to use PowerShell. So if we connect to our Exchange Management Shell, we can simply hit the following command:
Get-AutodiscoverVirtualDirectory -Server SERVER | fl
The received answer could look like this:
Additional information about this PowerShell command you can find HERE.
Another way is to use the IIS on the Exchange server. We simply browse to: StartPage > EXCSRV > Default Web Site > Autodiscover and here we are…
C-NAME
A CNAME (Canonical Name record) is a type of resource record in the DNS which is used to specify a domain name is an alias for another domain or sub domain. If we use the Autodiscover as the example, we talk about a sub domain. If our company has the domain contoso.com we need to create a DNS entry for the Autodiscover, that this can be find to. So we create a CNAME for that subdomain by defined values.
This can prove convenient when running multiple services (like an Autodiscover service and a webserver; each running on different ports) from a single IP address. One can, for example, point to autodiscover.contoso.com and www.contoso.com to the DNS entry for contoso.com, which in turn has an A record which points to the IP address. Then, if the IP address ever changes, one only has to record the change in one place within the network: in the DNS A record for contoso.com.
CNAME records are handled specially in the domain name system, and have several restrictions on their use. When a DNS resolver encounters a CNAME record while looking for a regular resource record, it will restart the query using the canonical name instead of the original name.
See the example below for visualization:
NAME TYPE VALUE -------------------------------------------------- sub1.contoso.com. CNAME sub2.contoso.com. sub2.contoso.com. A 10.0.23.23
- Information, which is needed to create a working, CNAME in a public DNS is:
- NAME (The name we want to set eg. Autodiscover)
- TYPE (The type of the record we want to create, in this case CNAME)
- VALUE (Where to point the Name)
- TTL (Time to life for the entry)
A-Record
An A record maps a domain name to the IP address (IPv4) of the computer hosting the domain. Simply put, an A record is used to find the IP address of a computer connected to the internet from a name.
The A in A record stands for Address. Whenever you visit a web site, send an email, connect to Twitter or Facebook or do almost anything on the Internet, the address you enter is a series of words connected with dots.
For example, to access the DNSimple website you enter www.contoso.com. At our name server there is an A record that points to the IP address 104.215.95.187. This means that a request from your browser to www.contoso.com is directed to the server with IP address 104.215.95.187.
A Records are the simplest type of DNS records, yet one of the primary records used in DNS servers.
General Tipp: If you want to check existing entries of the different DNS settings for a Domain, you simply can use PowerShell and run the following command:
nslookup -q=a contoso.com
By using the –q= part of the command, the variable is the last letter. In the shown example I have used the letter “a”. This stays for the A-Record.
Here some examples for other options:
A = A-Record CNAME = CNAME TXT = TXT SRV = SRV Etc.
Summary:
Differences between the A and CNAME records
The A and CNAME records are the two common ways to map a host name (name hereafter) to one or more IP address. Before going ahead, it’s important that we really understand the differences between these two records. I’ll keep it simple.
The A record points a name to a specific IP. For example, if we want the name www.contoso.com to point to the server 104.215.95.187 we will configure:
www.contoso.com. A 104.215.95.187
The CNAME record points a name to another name, instead of an IP. The CNAME source represents an alias for the target name and inherits its entire resolution chain.