Complete guide to setup Exchange Server Hybrid deployment from Scratch - aaqibwani/M365 GitHub Wiki

Requirements:

At least 2 VMware or Hyper-V virtual machines. 3, if you want to add a client machine.

Create the VMs:

For the DC, create a virtual machine with at least 8 GB of RAM, 2 CPU cores and 25 GB disk space. You can reduce the RAM to 4 GB once Windows Server is installed and promoted to DC if you do not have enough resources on the host machine.

For the Exchange Server, create a virtual machine with at least 8 GB (16 GB preferably) of RAM, 2 CPU cores and 50 GB of disk space.

Setting up the Domain Controller

For the purpose of this tutorial, we will be installing Windows 2016 Datacenter edition. Once Windows is installed, we need to add the Active Directory Domain Services role on the server. Follow the below steps in order:

  • Name the Server: Run sysdm.cpl and in the Computer Name tab click on Change. Enter a relevant name for the VM, example DC or DC1. Click Ok and restart the machine.
  • Configure IP settings: Open cmd and run ipconfig to list the details of your network. Now simultaneously open Network Connections by running ncpa.cpl. Double-click your network adapter and go to Properties. Then double-click on the Internet Protocol Version 4 and select use the following IP address and put the existing IP, subnet mask and gateway you got from the ipconfig command as shown below. Then in the Preferred DNS server put the loopback IP 127.0.0.1. This is to ensure that the IP does not change when we restart the VM, since this VM will also be our DNS server.

image

  • Install ADDS (Active Directory Domain Services) Role: To install AD, go to Server Manager > Manage > Add Roles and Features. In the dialog box, click next, Role based or feature based option will be pre-selected > Click Next. In the next page the current server will be already selected, keep it as it and click Next. In the Select Server roles, tick the checkbox for Active Directory Domain Services.
  • Here you need to add your domain that you own OR you can also add a .local domain. If you already have ADDS setup, you can add the UPN suffix.

Reboot the machine and login to the Domain:

image

image

At this point we are done with installing Active Directory with domain as idiotbox.com. We can now create the users or groups if required. We can now proceed with the installation of Exchange Server.

In case you already have ADDS setup with a different domain or have a .local domain, you can add the UPN suffix using AD Domains & Trusts as below, the important thing is that one of these domains needs to be verified in M365 as well.

Screenshot 2024-11-01 145411

image


Installing Exchange Server

Before we start installing Exchange on the VM, we'll need to do a couple other things:

  • Change the DNS server to the DC we previously created: Screenshot 2024-10-10 185518

  • Rename the VM (same steps we followed for the DC above), example we rename it to Exch1

  • Connect the VM to the AD domain Screenshot 2024-10-10 185710

Now, we can proceed with the installation of the Exchange Server 2016 prerequisites for Windows Server 2016:

At this point of time, we'll restart the VM a couple of times to ensure all pending reboots are complete.

Installing the Exchange 2016 Server:

After you restart the server, make sure to log back in using an AD admin account. If you have followed the previous steps, it will be default Administrator account we setup for our DC. Else, it needs to be an admin account with Domain Admin and Schema Admin privileges. image

Mount the Exchange Server ISO, open command prompt as an admin and navigate to the root of the drive where the ISO was mounted, then run the below commands: Example, if the ISO was mounted on D drive, run

cd D:

Extend the AD Schema to include the Exchange attributes

<Virtual DVD drive letter>:\Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareSchema

Example: Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareSchema

image

Preparing the AD to create containers, objects, and other items in Active Directory to store information

<Virtual DVD drive letter>:\Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAD /OrganizationName:"<Organization name>"

Example: Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAD /OrganizationName:"Evil Corp"

Preparing the Domain to create additional containers and security groups, and set the permissions so Exchange can access them

<Virtual DVD drive letter>:\Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAllDomains

Example: Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /PrepareAllDomains image

Installing the Mailbox server Role

Setup.exe /IAcceptExchangeServerLicenseTerms_DiagnosticDataON /Mode:Install /Roles:Mailbox /on:"Evil Corp"

image

Verify Installation

Check if all the required Exchange services are running:

image

Check if you are able to access ECP and OWA

image

Check if you are able to access Exchange Management Shell

image

Post installation configurations:

  • Renaming the Virtual Directories

  • Purchasing a 3rd party SAN certificate for the domain

You can either purchase a 3rd party SSL certificate or Get and install a FREE Exchange SAN certificate

Install and Configure AADConnect

  • Download AADConnect (Microsoft Entra Connect) tool from Microsoft Entra Connect
  • Install AADConnect. Use custom installation.
  • On the User Sign-in page, we will select Password Hash Synchronization and enable Single Sign-on for the purpose of this tutorial. Read more about PHS and SSO:

Screenshot 2024-10-12 015055

  • Enter the username of the AAD account with the following least privileges:

Screenshot 2024-10-12 015214

  • Let AADConnect create a separate AD account that will be used for synchronization. Enter your Admin credentials to validate:

Screenshot 2024-10-12 020147

Screenshot 2024-10-12 020312

  • Since I have not added the idiotbox.com domain to my M365 tenant (as I do not own this), I will click on 'Continue without matching...'. But you can add your custom domain to M365.

Screenshot 2024-10-12 020400

  • Select the OU's whose objects you want to sync to AAD. I have selected the Users and Computers default OU, however you can create a new OU and use it as well.

Screenshot 2024-10-12 020436

Screenshot 2024-10-12 020450

Screenshot 2024-10-12 020504

Screenshot 2024-10-12 020522

Screenshot 2024-10-12 020640

Screenshot 2024-10-12 020658

Screenshot 2024-10-12 021318

Screenshot 2024-10-12 021912

Screenshot 2024-10-12 022056

Screenshot 2024-10-12 022309

Configuring Exchange Hybrid

  • Download the Hybrid Configuration wizard from aka.ms/hybridwizard. Use Internet Explorer or Edge to download else you will get an error about different Security Zones Screenshot 2024-10-15 225124

Screenshot 2024-10-15 225223

  • If you get an error saying download is blocked, enable the downloads from:

Screenshot 2024-10-15 230131

  • The HCW will open: Screenshot 2024-10-15 225337

  • Click on Next and select license this server. Your Exchange Server will be licensed: Screenshot 2024-10-15 232943

  • Click Next and sign in to your AAD account with a Global Admin or Exchange Admin role.

Screenshot 2024-11-01 153734

  • Click Next and select Full Hybrid

Screenshot 2024-10-15 233035

  • We can either go with Classic or Modern Hybrid depending upon if we procured a 3rd party SAN certificate and have the EWS virtual directory published in public DNS. For the purpose of this lab, we will go with Modern Hybrid.

Screenshot 2024-11-01 154022

  • Keep the default selection:

Screenshot 2024-11-01 154044

  • If you have not configured the Virtual Directories and populated the Internal/External URLs particularly the External URL for EWS, it will ask you to do that, enter the domain that has a public DNS:

Screenshot 2024-11-01 154144

  • Enter the On-prem Admin credentials, this account will be used for hybrid mailbox migrations. It is also possible that the password expires in the near future. At that time you'll have to update the migration endpoint using PowerShell:

Screenshot 2024-11-01 154216

  • Now, the Hybrid Agent setup will happen:

Screenshot 2024-11-01 154744

  • On the next page, we will select CAS, as we do not intend to deploy an Edge Server:

Screenshot 2024-11-01 154756

  • Next, you'll be asked to select the server to host the Receive and Send Connectors:

Screenshot 2024-11-01 154811

Screenshot 2024-11-01 154826

  • Next, you'll be asked to select the certificate. If you have installed a 3rd party certificate, you'll select that one.
  • Next, enter the FQDN of your organization
  • The setup will complete or maybe have one or more issues. Depending upon the issues you encounter, you can fix them later by running the respective cmdlets in EMS:

Screenshot 2024-11-01 163136

I received an error because I did not install a new certificate on the server, however I can safely close it and later configure it manually.

Verify Exchange Hybrid Setup

  • We can now try to provision a remote mailbox from Exchange on-premises and verify that the mailbox is provisioned in Exchange Online:
  • Open EMS and run:

Screenshot 2024-11-01 231731

  • Then run Delta Sync or wait for the next sync cycle
  • Verify the mailbox is created in Exchange Online:

image

Our Exchange Hybrid Setup is complete!