MSEndpointMgr
Notes from the field on Hybrid Exchange in Azure

Hybrid Exchange in Azure: Notes from the field

Having an Exchange Hybrid Management server is still an official requirement from Microsoft to support organizations using Exchange Online with identities managed by the on-prem Active directory. So, if you are moving your entire “legacy” datacenter to Azure, it means having your Hybrid Exchange in Azure for management going forward.

I was doing this the other day and decided to see how small I could make it without too much hassle as time was limited.

The goal was to have a relatively cheap VM in Azure, hosting the last “on-premise” Hybrid Exchange Server 2016 (not 2019 as that costs money). And not caring so much about it being “snappy.”

Preface

For these notes to be useful, you are expected to have a general knowledge of Exchange Hybrid Topology, and a functioning Azure VNET with connectivity to on-prem is required.

Note that there are no detailed steps in this guide as things change around in Azure way too often, and security is very individual. I just wrote this article to share some experiences that could be of use to the MS IT Pro community; feel free to add comments that provide more knowledge to other readers.

Choosing the Right VM

The requirements for Exchange Server 2016 Hybrid are quite extreme. So if we are to keep things on the cheap, a B4ms is the “right” size. Since we need the Mailbox role, a VM with 2cores and 8GB RAM will start puking right away.

Nevertheless, this is what I was aiming to do – run an Exchange Server 2016 on a B2ms general-purpose server in Azure. Using only standard HDD to keep things cheap.

VM sizes in Azure

This is a very cheap option. If not the cheapest one for running a 2core 8GB RAM VM in Azure.

Disk sizing

In the spirit of building on the cheap, I choose to use Standard HDD (LRS) all around.

The default Windows Server 2016 Datacenter image from the Azure marketplace is 127GB. I added a 64GB data disk just for the Exchange Servers program files, without host caching for robustness.

Building on the cheap

Disk config in Azure

NB: Keep in mind that if you use the Exchange Hybrid server for a ton of management stuff, you might end up with a higher cost for the Standard HDD than a 64GB Premium SSD disk due to the way transactions on the disks are billed. Premium SSD is billed at a fixed cost, Standard HDD is billed per transaction. So keep an eye on those transaction costs!

Installing the Hybrid Exchange in Azure

During the initial VM provisioning, I choose the B4ms VM size to avoid problems during the installation of Exchange Server 2016.

A word of warning here, though; I did try the installation with the smaller B2ms size! But it puked out on me halfway through and threw some weird, useless PowerShell warning when I tried to restart the installation. If that happens to you, note that it might be because all exchange services are marked as stopped and disabled. But for some reason, the Installer cannot handle not being able to disable services that are already disabled. The solution is to start any “Microsoft Exchange” service that will start and rerun the installer to satisfy its requirement to disable all services during repair of the broken install.

You can download the latest CU from this link. It contains the full Exchange Server installation. And after you finish the install, nothing more is needed except following up with Windows Update after installing the service.

Updates for Exchange Server, Cumulative Updates for Exchange Server, Exchange Server 2016 CU, Cumulative Update Exchange 2016 | Microsoft Docs

I won’t go through the steps for installing the actual Exchange Server, just note that you need the following options set:

  • Roles: Mailbox, Management
  • File paths:
    • Change C:\Program Files\Microsoft\Exchange Server\V15
    • To: F:\Exchange Server\V15

You can change F: to whatever drive letter you configured for the data disk (yeah you need to go into disk manager and initialize that disk, otherwise it’s not gonna do you much good).

This is what my disk layout looks like after all is said and done:

Hybrid Exchange in Azure VM Disk layout
Disk layout on Azure VM

Yes, I could have added a smaller disk image for the OS, but that’s the beauty of Standard HDD; you only get billed for the disk’s actual storage consumption. If I had chosen Premium SSD instead, I would have opted for the 64GB “Small Disk” image.

Resizing the Azure VM

So I managed to get the Exchange Server running on a larger VM size and have confirmed that everything works as expected:

  • Public certificates are installed and assigned to services (not needed for minimal hybrid, though).
  • Traffic is flowing as it should.
  • The server is visible to the rest of the Exchange Organization.
  • I have rerun the Hybrid Configuration Wizard to move the hybrid mail flow to the new server.

Now I need to make sure it would not puke if I resize the VM to a B2ms in Azure…

A small amount of prepping was required!

Page file

To accept my wish of running on a smaller VM, I needed to rely on the good old page file, which I know is bad, but in my case, it was of no real consequence.

I configured the Page file to fit on the temporary “physical” disk that the VM has, which for my target VM size, was 16GB. To be sure, I set it at a little less (15000MB):

Hybrid Exchange Page File settings
Page file for Hybrid Exchange in Azure

While I was inside the “Performance Options,” I also checked that the “Visual Effects” were set to the most performant.

Log files

Exchange Servers 2013+ are notorious for their heavy use of logging, and I knew that sooner or later, my tiny Hybrid Exchange VM would get filled up with (in my case) useless log files.

I set up a basic scheduled task to run as SYSTEM once a day. The action it would perform is to execute a small PowerShell script that I put in F:\scripts.

Log purge task for Exchange Hybrid

You can grab a copy of the script, with the paths defined as per this blog post, here:

ExchangeOnlineScripts/invoke-logPurge.ps1 at main ยท mardahl/ExchangeOnlineScripts (github.com)

Conclusion

After doing all of the above, I could resize the VM to a B2ms size, and it loaded up just fine with no complaints about low memory, and the performance is acceptable for the management tasks that the server was intended for.

I hope you found some inspiration in the above for running your Hybrid Exchange in Azure, and as always, I welcome constructive comments and a follow on Twitter, so I know you are out there reading.

Michael Mardahl

Michael Mardahl is a seasoned IT pro with over 25 years of experience under his belt. He's a Microsoft Certified Cloud Architect at APENTO in Denmark, where he helps customers move from traditional infrastructure to the cloud while keeping security top of mind. When he's not working, Michael's either spending time with his family and friends or passionately blogging about Microsoft cloud technology. His expertise in this area has even earned him the prestigious title of Microsoft Most Valuable Professional (MVP) in both the Enterprise Mobility and Security categories. In short, Michael is the IT equivalent of a rockstar, but don't expect him to act like one - he's way too down-to-earth for that.

2 comments

Sponsors