Autodiscover and you (External Access)…Part Deux
Posted by Jake | Posted in Exchange, Exchange 2010, Techie Stuff | Posted on 03-02-2012-05-2008
0
I apologize for not writing part two of this article in a timely matter, then again, when is anything timely on this blog? I seem to only get inspiration to write when it’s the most inconvenient, of course. Like at 30,000 feet and all you have with you is your iPad. Oh well, adapt and overcome. If you want timely news and articles, go visit my boy Scott Feltmann. Just be sure to click on his ads there, he needs to buy his future NHL star a new hockey stick.
So, let’s talk about how external Exchange 2010 clients discover and are updated when you are not within the friendly confines of your company’s network.
By default, when first creating your profile, if you hadn’t already configured it, the Outlook client (2007/2010/2011) will query the following URL’s in the following order:
- The autodiscover service connection point URL (if you are on an active directory joined workstation). From the outside this should fail, and if it doesn’t, you need a new network security guy.
- Then it will query the base domain of the email address you entered in the second line of the profile creation wizard. So if your email is Jake@domain.com, that address would be: https://domain.com/autodiscover/autodiscover.xml.
- Should that fail, it will immediately try http://domain.com/autodiscover/autodiscover.xml.
- When/if that fails, it will then switch to https://autodiscover.domain.com/autodiscover/autodiscover.xml
- Should that fail, it will then try http://autodiscover.domain.com/autodiscover/autodiscover.xml
If you are a visual kind of person (like me), here is the picture of how it works:

Now, if your environment is properly configured, this should be all you need, but there are two other ways that your client can use to find your shiny new Exchange 2010 environment.
- The good old fashioned SRV record in DNS. This method can be used internally as well. This can be handy in multiple mail domain scenarios or migrations between forests.
- You can also hard code Autodiscover settings into the registry and ensure your client doesn’t have to bother with going to look up it’s settings. Unfortunately, in the event of a change in your Exchange environment to Autodiscover, this may not get updated and your clients could be left in the dark.
You must be asking at this point “what method should I configure here?”. Well, it depends on your environment. Most security conscious admins really do not like opening port 80 inbound to their Exchange servers, unless you have something like TMG and UAG and can use the handy dandy redirect rules there to redirect the client to https, aka tcp/443.
Since most organizations do not host their own website, it can be difficult to create a virtual directory under the base domain to forward to the CAS servers, I usually do not go the first route.
I usually always recommend creating an external DNS record for autodiscover.domain.com and point that to the same external IP address as you would for OWA, ActiveSync, Outlook Anywhere, etc. Finding the record may take a few extra milliseconds, but it works flawlessly and doesn’t require getting the web developers involved and having to translate your communications to Linux/Apache for them, causing all sorts of confusion for those that don’t understand the Microsoft language of love. If you have TMG or UAG in your environment, then publish both http (with a redirect)and https there and off you go!
What’s that I hear? You want to know what this does for you? Well, the same thing as it does for internal clients! If you need a refresher, scroll down and read part 1 of this article. After the client authenticates to active directory, which the client will be prompted for if the client hasn’t already asked you for your active directory credentials in the wizard, it will send down to the client the same .XML file that you get as an internal user, except that since you are now outside of the company network, the client will read the second half of the .XML file after the EXPR section, and use those URL’s to connect to the various Exchange services such as The availability service, offline address book, Active Sync (if you are using your phone or tablet) and the Exchange Control Panel via OWA. This ensures you can connect to all of the features of Exchange that you know and love when you are in the office, but now from that Caribou Coffee shop that you love to sit at when not in the office. Pretty cool huh?
You can configure these URL’s either via the Exchange Management Console GUI or via the Exchange Management Shell, if you have confidence in your Powershell-fu. I have a nifty little script that I stole borrowed from Pat Richard and Patricio Anderson that does the trick, by setting all of the URL’s for me automagically with only a few keystrokes. Saves me the embarrassment of going back and fixing a typo later on.
Note that autodiscover does not have a GUI tab to set it’s URL’s, and the external URL is not set by default. You have to use the EMS to set the URL’s for autodiscover. Note: if you have multiple sites with Exchange CAS role servers, do not set the external URL on the sites that are not Internet facing, this will break your proxy between sites and will attempt to redirect externally instead. Only set the external URL’s on Internet facing CAS servers!
Pro tip: Technically, you do not need to add the external URL for Autodiscover as long as your DNS names are correct. But it is helpful to add them if you are integrated with Lync and/or Sharepoint.
The Powershell command to set autodiscover URL’s are:
Set-autodiscovervirtualdirectory -identity “server name/autodiscover (default web site)” – externalurl https://autodiscover.domain.com/autodiscover/autodiscover.xml.
Set this on all of your Internet facing CAS servers (this is where the script comes in handy!) or use remote Powershell instead.
Set the other external URL’s for the other services as follows:
Set-ewsvirtualdirectory -identity “server name/EWS (Default web site) -externalurl https://owahostname.domain.com/EWS/exchange.asmx
Set-owavirtualdirectory -identity “server name”/owa (default web site) -externalurl https://owahostname.domain.com/owa
Set-ecpvirtualdirectory -identity “server name”/ecp (default web site) -externalurl https://owahostname.domain.com/ecp
Set-oabvirtualdirectory -identity “server name/oab (default web site) -externalurl https://owahostname.domain.com/oab
Set-activesyncvirtualdirectory -identity “server name”/Microsoft-Server-ActiveSync (default web site) -externalurl https://owahostname.domain.com/Microsoft-Server-ActiveSync
Set-umvirtualdirectory -identity “server name”/unifiedmessaging (default web site) -externalurl https://owahostname.domain.com/unifiedmessaging
Pro tip: you can just type in -id server name/autodiscover* as a faster way to enter the server name and to prevent using quotes in your command.
Whew! That was a lot of commands! Especially while typing on an iPad! ensuring your external URL’s are set properly is a key component to ensuring your Exchange environment works as designed and keeps your users happy, which is why we all do this, right?
Pro tip: do not use your CAS array name as your external URL name. This can cause performance issues upon connecting to Exchange externally as the CAS array internal name and IP address are cached and will attempt to connect to that IP address first before attempting to connect to the external URL’s. Ross Smith of the Exchange Product Team has a great article about this here:
Finally, a lot of my clients ask me if there is any way to control access to those services from the outside. Some go as far as not configuring the external URL’s, thinking it will prevent access. Well, it does, in theory, but then your services do not work properly! If security is a concern, consider using Microsoft Unified Access Gateway to lock down access to these services to specific groups of users, or even specific workstations. There are ways to only allow specific types of phones and active sync devices via the active sync policies. You could even go as far as implementing certificate based authentication with TMG. My compadre Jeff Gulliet has a phenomenal article about how to implement that solution here.
Thats all folks! As usual, leave your comments below and have a great day!








