Deploying Microsoft Exchange
- Prepare your cloud
- Create a cloud network and subnets
- Create a script to manage a local administrator account
- Create a VM for Active Directory
- Create a VM for File Share Witness
- Install and configure Active Directory
- Configure the second domain controller
- Install Microsoft Exchange
- Create Microsoft Exchange servers
- Create a Database Availability Group
- Configure Client Access
- Configure the network load balancer
- Configure Accepted Domains and Email Address Policy
- Create a VM for Edge Transport servers
- Configure Edge Transport servers
- Add Edge Transport servers to Exchange
- How to delete the resources you created
Warning
In Yandex Cloud, you can only use Microsoft products with your own licenses and on dedicated hosts. For more information, see Use of personal licenses for Microsoft products.
This tutorial describes how to deploy Microsoft Exchange servers in Yandex Cloud. We will install two Microsoft Exchange mail servers, two Active Directory servers, and two Edge Transport services in the ru-central1-a
and ru-central1-b
availability zones. A network load balancer will distribute load across servers. All servers will be managed via a separate VM with internet access in the ru-central1-d
availability zone.
- Prepare your cloud.
- Create a cloud network and subnets.
- Create a script to manage a local administrator account.
- Create a VM for Active Directory.
- Create a VM for File Share Witness.
- Install and configure Active Directory.
- Configure the second domain controller.
- Install Microsoft Exchange.
- Create Microsoft Exchange servers.
- Create a Database Availability Group.
- Configure Client Access.
- Configure the network load balancer.
- Configure Accepted Domains and Email Address Policy.
- Create and configure a VM for Edge Transport servers
- Configure Edge Transport servers.
- Add Edge Transport servers to Exchange.
If you no longer need the resources you created, delete them.
Prepare your cloud
Sign up for Yandex Cloud and create a billing account:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
Note
Make sure that the billing account contains user details required to meet the Microsoft licensing policy requirements. You can launch the product only if you have these details.
Required paid resources
The cost of a Microsoft Exchange installation includes:
- Fee for continuously running virtual machines (see Yandex Compute Cloud pricing).
- Fee for load balancing (see Yandex Network Load Balancer pricing).
- Fee for using dynamic or static public IP addresses (see Yandex Virtual Private Cloud pricing).
- Cost of outgoing traffic from Yandex Cloud to the internet (see Yandex Compute Cloud pricing).
Create a cloud network and subnets
Create a cloud network named exchange-network
with subnets in all the availability zones where your VMs will be located.
-
Create a cloud network:
Management consoleCLITo create a cloud network:
- Open the Virtual Private Cloud section of the folder where you want to create a cloud network.
- Click Create network.
- Enter the network name:
exchange-network
. - Click Create network.
To create a cloud network, run the command:
yc vpc network create --name exchange-network
-
Create three
exchange-network
subnets:Management consoleCLITo create a subnet:
- Open the Virtual Private Cloud section in the folder to create a subnet in.
- Click the name of the cloud network.
- Click Add subnet.
- Fill out the form: enter
exchange-subnet-a
as the subnet name and select theru-central1-a
availability zone from the drop-down list. - Enter the subnet CIDR, which is its IP address and mask:
10.1.0.0/16
. For more information about subnet IP address ranges, see Cloud networks and subnets. - Click Create subnet.
Repeat these steps for two more subnets,
exchange-subnet-b
andexchange-subnet-d
, in theru-central1-b
andru-central1-d
availability zones with the10.2.0.0/16
and10.3.0.0/16
CIDR, respectively.To create subnets, run the following commands:
yc vpc subnet create \ --name exchange-subnet-a \ --zone ru-central1-a \ --network-name exchange-network \ --range 10.1.0.0/16 yc vpc subnet create \ --name exchange-subnet-b \ --zone ru-central1-b \ --network-name exchange-network \ --range 10.2.0.0/16 yc vpc subnet create \ --name exchange-subnet-d \ --zone ru-central1-d \ --network-name exchange-network \ --range 10.3.0.0/16
Create a script to manage a local administrator account
Create a file named setpass
with a script that will set a password for the local administrator account when creating VMs via the CLI:
#ps1
Get-LocalUser | Where-Object SID -like *-500 | Set-LocalUser -Password (ConvertTo-SecureString "<your password>" -AsPlainText -Force)
The password must meet the complexity requirements
Learn more about security best practices for Active Directory on the official website
Create a VM for Active Directory
Create two virtual machines for Active Directory. These VMs will not have internet access.
-
On the folder page in the management console
, click Create resource and select Virtual machine. -
In the Name field, enter the VM name:
ad-vm-a
. -
Select the
ru-central1-a
availability zone. -
Under Image/boot disk selection, click the Cloud Marketplace tab, and select the Windows Server 2016 Datacenter image.
-
Under Disks, enter 50 GB for the size of the boot disk.
-
Under Computing resources:
- Select the platform: Intel Ice Lake.
- Specify the required number of vCPUs and the amount of RAM:
- vCPU: 4
- Guaranteed vCPU share: 100%
- RAM: 8 GB
-
Under Network settings, select the
exchange-subnet-a
subnet. In the Public addressfield, select No address. -
Click Create VM.
Wait for the VM status to change to Running
and reset the password:
- Select the VM.
- Click Reset password.
- Specify the Username to reset the password for. If there is no user with that name on the VM, this user will be created with administrator access.
- Click Generate password.
- Save the New password. It will become unavailable once you close the window.
Repeat the steps for the ad-vm-b
VM in the ru-central1-b
availability zone and connect it to the exchange-subnet-b
subnet.
yc compute instance create \
--name ad-vm-a \
--hostname ad-vm-a \
--memory 8 \
--cores 4 \
--zone ru-central1-a \
--network-interface subnet-name=exchange-subnet-a,ipv4-address=10.1.0.3 \
--create-boot-disk image-folder-id=standard-images,image-family=windows-2016-gvlk \
--metadata-from-file user-data=setpass
yc compute instance create \
--name ad-vm-b \
--hostname ad-vm-b \
--memory 8 \
--cores 4 \
--zone ru-central1-b \
--network-interface subnet-name=exchange-subnet-b,ipv4-address=10.2.0.3 \
--create-boot-disk image-folder-id=standard-images,image-family=windows-2016-gvlk \
--metadata-from-file user-data=setpass
Create a VM for File Share Witness
A file server with internet access is used to configure VMs with Active Directory.
-
On the folder page in the management console
, click Create resource and select Virtual machine. -
In the Name field, enter the VM name:
fsw-vm
. -
Select the
ru-central1-d
availability zone. -
Under Image/boot disk selection, click the Cloud Marketplace tab, and select the Windows Server 2016 Datacenter image.
-
Under Disks, enter 50 GB for the size of the boot disk.
-
Under Computing resources:
- Select the platform: Intel Ice Lake.
- Specify the required number of vCPUs and the amount of RAM:
- vCPU: 2
- Guaranteed vCPU share: 100%
- RAM: 4 GB
-
Under Network settings, select
exchange-subnet-d
. In the Public address field, select Auto. -
Click Create VM.
Wait for the VM status to change to Running
and reset the password:
- Select the VM.
- Click Reset password.
- Specify the Username to reset the password for. If there is no user with that name on the VM, this user will be created with administrator access.
- Click Generate password.
- Save the New password. It will become unavailable once you close the window.
yc compute instance create \
--name fsw-vm \
--hostname fsw-vm \
--memory 4 \
--cores 2 \
--zone ru-central1-d \
--network-interface subnet-name=exchange-subnet-d,nat-ip-version=ipv4 \
--create-boot-disk image-folder-id=standard-images,image-family=windows-2016-gvlk \
--metadata-from-file user-data=setpass
Install and configure Active Directory
VMs with Active Directory do not have internet access, so they should be configured from the fsw-vm
VM using RDP.
-
Connect to
fsw-vm
using RDP. EnterAdministrator
as the username and then your password. -
On the
fsw-vm
VM instance, start the RDP client and connect to thead-vm-a
VM. EnterAdministrator
as the username and then your password. -
On the
ad-vm-a
VM, run PowerShell and set a static address:netsh interface ip set address "eth0" static 10.1.0.3 255.255.255.0 10.1.0.1
-
Create a temporary folder:
mkdir C:\Windows\temp
-
Assign Active Directory roles:
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Result:
Success Restart Needed Exit Code Feature Result ------- -------------- --------- -------------- True No Success {Active Directory Domain Services, Group P...
-
Create an Active Directory forest:
Install-ADDSForest -DomainName 'yantoso.net' -Force:$true
Windows restarts automatically. After it restarts, log in to
ad-vm-a
with theyantoso\Administrator
account login and your password. Relaunch PowerShell. -
Rename the default site
ru-central1-a
:Get-ADReplicationSite 'Default-First-Site-Name' | Rename-ADObject -NewName 'ru-central1-a'
-
Create two more sites for the other availability zones:
New-ADReplicationSite 'ru-central1-b' New-ADReplicationSite 'ru-central1-d'
-
Create subnets and link them to the sites:
New-ADReplicationSubnet -Name '10.1.0.0/16' -Site 'ru-central1-a' New-ADReplicationSubnet -Name '10.2.0.0/16' -Site 'ru-central1-b' New-ADReplicationSubnet -Name '10.3.0.0/16' -Site 'ru-central1-d'
-
Rename the site link and configure replication:
Get-ADReplicationSiteLink 'DEFAULTIPSITELINK' | ` Set-ADReplicationSiteLink -SitesIncluded @{Add='ru-central1-b'} -ReplicationFrequencyInMinutes 15 -PassThru | ` Set-ADObject -Replace @{options = $($_.options -bor 1)} -PassThru | ` Rename-ADObject -NewName 'ru-central1'
-
Set the DNS redirect server:
Set-DnsServerForwarder '10.1.0.2'
-
Configure the DNS client:
Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses "10.2.0.3,127.0.0.1"
Configure the second domain controller
-
Connect to
fsw-vm
using RDP. EnterAdministrator
as the username and then your password. -
On the
fsw-vm
VM instance, start the RDP client and connect to thead-vm-b
VM. EnterAdministrator
as the username and then your password. -
Create a temporary folder:
mkdir C:\Windows\temp
-
Assign Active Directory roles:
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Result:
Success Restart Needed Exit Code Feature Result ------- -------------- --------- -------------- True No Success {Active Directory Domain Services, Group P...
-
Configure the DNS client:
Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses "10.1.0.3,127.0.0.1"
-
Configure a static IP address:
netsh interface ip set address "eth0" static 10.2.0.3 255.255.255.0 10.2.0.1
-
Add the controller to the domain:
Install-ADDSDomainController ` -Credential (Get-Credential "yantoso\Administrator") ` -DomainName 'yantoso.net' ` -Force:$true
Windows restarts automatically. After it restarts, log in to
ad-vm-b
with theyantoso\Administrator
account and your password. Relaunch PowerShell. -
Set the DNS redirect server:
Set-DnsServerForwarder '10.2.0.2'
Install Microsoft Exchange
-
Connect to
fsw-vm
using RDP and launch PowerShell. -
Configure the DNS client:
Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses "10.1.0.3,10.2.0.3"
-
Add the server to the domain:
$Credentials = Get-Credential # yantoso\Administrator Add-Computer -DomainName yantoso.net -DomainCredential $Credentials -Force -Restart
Windows restarts automatically. After it restarts, log in to
fsw-vm
with theyantoso\Administrator
account login and your password. Relaunch PowerShell. -
Create a folder named
distrib
:mkdir c:\distrib
-
Download the Exchange Server distribution
and required dependencies:- .NET Framework 4.7.2
. - Visual C++ Redistributable Package for Visual Studio 2012
. Rename the downloaded file tovcredist_x64_2012.exe
. - Visual C++ Redistributable Package for Visual Studio 2013
. Rename the downloaded file tovcredist_x64_2013.exe
. - Microsoft Unified Communications Managed API 4.0, Core Runtime 64-bit
.
Put the distributions in the directory
C:\distrib
. - .NET Framework 4.7.2
-
Grant shared access from the domain to the directory with distributions:
New-SmbShare -ReadAccess 'yantoso\domain users' -Path 'c:\distrib' -Name 'distrib'
Create Microsoft Exchange servers
Create the first Exchange server
-
Create a VM named
vm-exchange-a
:Management consoleCLI-
On the folder page in the management console
, click Create resource and select Virtual machine. -
In the Name field, enter the VM name:
vm-exchange-a
. -
Select the
ru-central1-a
availability zone. -
Under Image/boot disk selection, click the Cloud Marketplace tab, and select the Windows Server 2016 Datacenter image.
-
Under Disks, enter 100 GB for the size of the boot disk.
-
Add another 250 GB SSD named
db-a
. -
Under Computing resources:
- Select the platform: Intel Ice Lake.
- Specify the required number of vCPUs and the amount of RAM:
- vCPU: 8
- Guaranteed vCPU share: 100%
- RAM: 32 GB
-
Under Network settings, select the
exchange-subnet-a
subnet. In the Public addressfield, select No address. -
Click Create VM.
Wait for the VM status to change to
Running
and reset the password:- Select the VM.
- Click Reset password.
- Specify the Username to reset the password for. If there is no user with that name on the VM, this user will be created with administrator access.
- Click Generate password.
- Save the New password. It will become unavailable once you close the window.
yc compute instance create \ --name vm-exchange-a \ --hostname vm-exchange-a \ --memory 32 \ --cores 8 \ --zone ru-central1-a \ --network-interface subnet-name=exchange-subnet-a \ --create-boot-disk size=100,image-folder-id=standard-images,image-family=windows-2016-gvlk \ --create-disk type=network-ssd,size=250,auto-delete=false \ --metadata-from-file user-data=setpass
-
-
Connect to
fsw-vm
using RDP. -
On the
fsw-vm
VM instance, start the RDP client and connect to thevm-exchange-a
VM. EnterAdministrator
as the username and then your password. Launch PowerShell. -
Configure the DNS client:
Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses "10.1.0.3"
-
Add
vm-exchange-a
to the domain:$Credentials = Get-Credential # yantoso\Administrator Add-Computer -DomainName yantoso.net -DomainCredential $Credentials -Force -Restart
After it restarts, log in to the VM with the
yantoso\Administrator
account login and your password. Relaunch PowerShell. -
Install the downloaded dependencies in the following order:
& \\fsw-vm\distrib\vcredist_x64_2012.exe /install /passive /norestart
& \\fsw-vm\distrib\vcredist_x64_2013.exe /install /passive /norestart
& \\fsw-vm\distrib\UcmaRuntimeSetup.exe /install /passive /norestart
& \\fsw-vm\distrib\NDP472-KB4054530-x86-x64-AllOS-ENU.exe /install /passive /norestart
-
Restart the VM:
Restart-Computer -Force
.After it restarts, log in to the VM with the
yantoso\Administrator
account login and your password. Relaunch PowerShell. -
Install Exchange Mailbox Server on
vm-exchange-a
. Mount the distribution image from the shared folder with distributions:Mount-DiskImage \\fsw-vm\distrib\ExchangeServer2016-x64-cu13.iso
-
Install Exchange Mailbox Server:
& D:\Setup.exe /Mode:Install /InstallWindowsComponents /Role:Mailbox /IAcceptExchangeServerLicenseTerms /OrganizationName:MyOrg Restart-Computer -Force
When the installation is complete, the VM restarts automatically.
Create the second Exchange server
-
Create a VM named
vm-exchange-b
:Management consoleCLI-
On the folder page in the management console
, click Create resource and select Virtual machine. -
In the Name field, enter the VM name:
vm-exchange-b
. -
Select the
ru-central1-b
availability zone. -
Under Image/boot disk selection, click the Cloud Marketplace tab, and select the Windows Server 2016 Datacenter image.
-
Under Disks, enter 100 GB for the size of the boot disk.
-
Add another 250 GB SSD named
db-b
. -
Under Computing resources:
- Select the platform: Intel Ice Lake.
- Specify the required number of vCPUs and the amount of RAM:
- vCPU: 8
- Guaranteed vCPU share: 100%
- RAM: 32 GB
-
Under Network settings, select the
exchange-subnet-b
subnet. In the Public addressfield, select No address. -
Click Create VM.
Wait for the VM status to change to
Running
and reset the password:- Select the VM.
- Click Reset password.
- Specify the Username to reset the password for. If there is no user with that name on the VM, this user will be created with administrator access.
- Click Generate password.
- Save the New password. It will become unavailable once you close the window.
yc compute instance create \ --name vm-exchange-b \ --hostname vm-exchange-b \ --memory 32 \ --cores 8 \ --zone ru-central1-b \ --network-interface subnet-name=exchange-subnet-b \ --create-boot-disk size=100,image-folder-id=standard-images,image-family=windows-2016-gvlk \ --create-disk type=network-ssd,size=250,auto-delete=false \ --metadata-from-file user-data=setpass
-
-
Connect to
fsw-vm
using RDP. -
On the
fsw-vm
VM instance, start the RDP client and connect to thevm-exchange-b
VM. EnterAdministrator
as the username and then your password. Launch PowerShell. -
Configure the DNS client:
Get-NetAdapter | Set-DnsClientServerAddress -ServerAddresses "10.1.0.3"
-
Add
vm-exchange-a
to the domain:$Credentials = Get-Credential # yantoso\Administrator Add-Computer -DomainName yantoso.net -DomainCredential $Credentials -Force -Restart
After it restarts, log in to the VM with the
yantoso\Administrator
account login and your password. Relaunch PowerShell. -
Install the downloaded dependencies in the following order:
& \\fsw-vm\distrib\vcredist_x64_2012.exe /install /passive /norestart
& \\fsw-vm\distrib\vcredist_x64_2013.exe /install /passive /norestart
& \\fsw-vm\distrib\UcmaRuntimeSetup.exe /install /passive /norestart
& \\fsw-vm\distrib\NDP472-KB4054530-x86-x64-AllOS-ENU.exe /install /passive /norestart
-
Restart the VM:
Restart-Computer -Force
.After it restarts, log in to the VM with the
yantoso\Administrator
account login and your password. Relaunch PowerShell. -
Install Exchange Mailbox Server on
vm-exchange-b
. Mount the distribution image from the shared folder with distributions:Mount-DiskImage \\fsw-vm\distrib\ExchangeServer2016-x64-cu13.iso
-
Install Exchange Mailbox Server:
& D:\Setup.exe /Mode:Install /InstallWindowsComponents /Role:Mailbox /IAcceptExchangeServerLicenseTerms /OrganizationName:MyOrg Restart-Computer -Force
When the installation is complete, the VM restarts automatically.
Create a Database Availability Group
A Database Availability Group ensures fault tolerance for mail servers via DB replication and automatic DB failover in the event of a crash.
-
Connect to
fsw-vm
using RDP. -
Grant the
yantoso\Exchange Trusted Subsystem
group administrator privileges to thefsw-vm
VM:Add-LocalGroupMember -Group 'Administrators' -Member 'yantoso\Exchange Trusted Subsystem'
Create disks for VM databases
-
On
fsw-vm
, start the RDP client and connect tovm-exchange-a
. Enteryantoso\Administrator
as the username and then your password. -
Create an additional disk and format it:
Get-Disk | ` Where-Object PartitionStyle -eq raw | ` Initialize-Disk -PartitionStyle GPT -PassThru | ` New-Partition -DriveLetter 'Z' -UseMaximumSize | ` Format-Volume -FileSystem NTFS -NewFileSystemLabel "mdb" -Confirm:$false -AllocationUnitSize 65536
-
Install the
Failover-Clustering
role:Install-WindowsFeature -Name 'Failover-Clustering' -IncludeManagementTools
Repeat these commands for the vm-exchange-b
VM.
Configure the Database Availability Group
-
On the
fsw-vm
VM instance, start the RDP client and use it to connect to thevm-exchange-a
VM. Enteryantoso\Administrator
as the username and then your password. -
Run the Exchange Management Shell.
-
Create a Database Availability Group:
New-DatabaseAvailabilityGroup ` -Name ycdag ` -WitnessServer fsw-vm ` -DatabaseAvailabilityGroupIpAddresses 255.255.255.255
-
Add the
vm-exchange-a
andvm-exchange-b
servers to the Database Availability Group (DAG):Add-DatabaseAvailabilityGroupServer -Identity ycdag -MailboxServer vm-exchange-a Add-DatabaseAvailabilityGroupServer -Identity ycdag -MailboxServer vm-exchange-b
-
Check the status of the servers. Both should be in the Operational Servers column:
Get-DatabaseAvailabilityGroup -Status
Result:
Name Member Servers Operational Servers ---- -------------- ------------------- ycdag {VM-EXCHANGE-A, VM-EXCHANGE-B} {VM-EXCHANGE-A, VM-EXCHANGE-B}
-
Create a mail server database:
New-MailboxDatabase -Name yamdb -EdbFilePath 'Z:\MDB\yamdb\yamdb.edb' -LogFolderPath 'Z:\MDB\yamdb\log' -Server vm-exchange-a
-
Mount the database:
Mount-Database yamdb
-
Create a copy of the database on the second server:
Add-MailboxDatabaseCopy -Identity yamdb -MailboxServer vm-exchange-b -SeedingPostponed Update-MailboxDatabasecopy yamdb\vm-exchange-b –CatalogOnly
-
Check the DB status:
Get-MailboxDatabaseCopyStatus -Server vm-exchange-a Get-MailboxDatabaseCopyStatus -Server vm-exchange-b
Configure Client Access
To work with various client applications, you need to create virtual directories.
-
Set the mail domain:
$MailDomain = "mail.yantoso.net"
-
ECP:
Get-EcpVirtualDirectory | Set-EcpVirtualDirectory -ExternalUrl "https://$MailDomain/ecp"
-
EWS:
Get-WebServicesVirtualDirectory | Set-WebServicesVirtualDirectory -ExternalUrl "https://$MailDomain/ews/exchange.asmx"
-
Active Sync:
Get-ActiveSyncVirtualDirectory | Set-ActiveSyncVirtualDirectory -ExternalUrl "https://$MailDomain/Microsoft-Server-ActiveSync"
-
OAB:
Get-OabVirtualDirectory | Set-OabVirtualDirectory -ExternalUrl "https://$MailDomain/OAB"
-
OWA:
Get-OwaVirtualDirectory | Set-OwaVirtualDirectory -ExternalUrl "https://$MailDomain/owa"
-
PowerShell:
Get-PowerShellVirtualDirectory | Set-PowerShellVirtualDirectory -ExternalUrl "https://$MailDomain/powershell"
-
MAPI:
Get-MapiVirtualDirectory | Set-MapiVirtualDirectory -ExternalUrl "https://$MailDomain/mapi"
Configure the network load balancer
It distributes the load across Exchange servers in different availability zones.
To create a network load balancer.
- Open the Load Balancer section in the folder where you want to create a load balancer.
- Click Create a network load balancer.
- Enter a name for the network load balancer:
exchange-lb
. - In the Public address field, select Auto.
- Click Add listener under Listeners.
- Enter a name for the listener:
yassl
- Set the listener port and target port to
443
and click Add. - Under Target groups, click Add target group.
- In the Target group field, open the drop-down list and select Create target group.
- Enter a name for the target group:
exchange-tg
. - Select the
vm-exchange-a
andvm-exchange-b
VMs and click Create. - Click Configure.
- Enter the
exchange-hc
health check name. - Select the TCP check.
- Set the port to
443
. - Keep the other parameters as default and click Apply.
- Click Create.
-
Create a network load balancer:
yc lb nlb create --name exchange-lb
-
Create a target group:
yc lb tg create --name exchange-tg
-
Get information about the mail servers:
yc compute instance get vm-exchange-a yc compute instance get vm-exchange-b
Copy the VM subnet IP addresses and IDs.
-
Add the servers to the target group:
yc lb tg update --name exchange-tg \ --target address=<IP address of vm-exchange-a>,subnet-id=<subnet ID for vm-exchange-a> \ --target address=<IP address of vm-exchange-b>,subnet-id=<subnet ID for vm-exchange-b>
-
Add the listener to the network load balancer:
yc lb nlb add-listener --name exchange-lb --listener name=yassl,port=443,target-port=443,external-ip-version=ipv4
-
Get information about the target groups:
yc lb tg list
Copy the ID of the target group.
-
Connect the target group to the network load balancer using the target group ID:
yc lb nlb attach-target-group \ --name exchange-lb \ --target-group target-group-id=<target group ID>,healthcheck-name=exchange-hc,healthcheck-tcp-port=443
Configure Accepted Domains and Email Address Policy
A domain is created by default. If you need to change the domain, use the command:
New-AcceptedDomain -Name yantoso.net -DomainName yantoso.net
Edit the Email Address Policy:
Get-EmailAddressPolicy | Set-EmailAddressPolicy -EnabledPrimarySMTPAddressTemplate '@yantoso.net'
An alias with the @yantoso.net
domain is automatically added to all the new mailboxes.
Create a VM for Edge Transport servers
Edge Transport servers handle the main user load: accept emails from the internet, filter out spam, and forward messages to the internal Exchange mail servers.
Create a VM for the vm-edge-a server
Create a VM named vm-edge-a
:
-
On the folder page in the management console
, click Create resource and select Virtual machine. -
In the Name field, enter the VM name:
vm-edge-a
. -
Select the
ru-central1-a
availability zone. -
Under Image/boot disk selection, click the Cloud Marketplace tab, and select the Windows Server 2016 Datacenter image.
-
Under Disks, enter 50 GB for the size of the boot disk.
-
Under Computing resources:
- Select the platform: Intel Ice Lake.
- Specify the required number of vCPUs and the amount of RAM:
- vCPU: 4
- Guaranteed vCPU share: 100%
- RAM: 8 GB
-
Under Network settings, select the
exchange-subnet-a
subnet. In the Public address field, select Auto or select an address from the list of the reserved addresses. -
Click Create VM.
Wait for the VM status to change to Running
and reset the password:
- Select the VM.
- Click Reset password.
- Specify the Username to reset the password for. If there is no user with that name on the VM, this user will be created with administrator access.
- Click Generate password.
- Save the New password. It will become unavailable once you close the window.
yc compute instance create \
--name vm-edge-a \
--hostname vm-edge-a \
--memory 8 \
--cores 4 \
--zone ru-central1-a \
--network-interface subnet-name=exchange-subnet-a,nat-ip-version=ipv4 \
--create-boot-disk size=50,image-folder-id=standard-images,image-family=windows-2016-gvlk \
--metadata-from-file user-data=setpass
Create a VM for the vm-edge-b server
Create a VM named vm-edge-b
:
-
On the folder page in the management console
, click Create resource and select Virtual machine. -
In the Name field, enter the VM name:
vm-edge-b
. -
Select the
ru-central1-b
availability zone. -
Under Image/boot disk selection, click the Cloud Marketplace tab, and select the Windows Server 2016 Datacenter image.
-
Under Disks, enter 50 GB for the size of the boot disk.
-
Under Computing resources:
- Select the platform: Intel Ice Lake.
- Specify the required number of vCPUs and the amount of RAM:
- vCPU: 4
- Guaranteed vCPU share: 100%
- RAM: 8 GB
-
Under Network settings, select the
exchange-subnet-b
subnet. In the Public address field, select Auto or select an address from the list of the reserved addresses. -
Click Create VM.
Wait for the VM status to change to Running
and reset the password:
- Select the VM.
- Click Reset password.
- Specify the Username to reset the password for. If there is no user with that name on the VM, this user will be created with administrator access.
- Click Generate password.
- Save the New password. It will become unavailable once you close the window.
yc compute instance create \
--name vm-edge-b \
--hostname vm-edge-b \
--memory 8 \
--cores 4 \
--zone ru-central1-b \
--network-interface subnet-name=exchange-subnet-b,nat-ip-version=ipv4 \
--create-boot-disk size=50,image-folder-id=standard-images,image-family=windows-2016-gvlk \
--metadata-from-file user-data=setpass
Configure Edge Transport servers
Configure the Edge Transport server in the ru-central1-a zone
-
Connect to
fsw-vm
using RDP. -
Connect to
vm-edge-a
using RDP. EnterAdministrator
as the username and then your password. Launch PowerShell. -
Create a temporary folder:
mkdir C:\Windows\temp
-
Install ADLDS roles on the server:
Install-WindowsFeature ADLDS
-
Configure the DNS client:
Get-NetAdapter | ` Set-DnsClientServerAddress -ServerAddresses "10.1.0.3,10.2.0.3"
-
Configure remote access to the directory with distributions on
fsw-vm
:$Credential = Get-Credential # Username: yantoso\Administrator New-PSDrive -Name 'fsw-vm' -PSProvider:FileSystem -Root '\\fsw-vm.ru-central1.internal\distrib' -Credential $Credential
Enter
yantoso\Administrator
as the username and then your password. -
Install the dependencies:
& fsw-vm:\vcredist_x64_2012.exe /install /passive /norestart & fsw-vm:\NDP472-KB4054530-x86-x64-AllOS-ENU.exe /install /passive /norestart
-
Copy the Microsoft Exchange distribution to the
vm-edge-a
server:copy-item fsw-vm:\ExchangeServer2016-x64-cu13.iso c:\windows\temp\ExchangeServer2016-x64-cu13.iso
-
Specify the primary DNS suffix:
$Suffix = 'ru-central1.internal' Set-ItemProperty -path HKLM:\system\CurrentControlSet\Services\tcpip\parameters -Name Domain -Value $Suffix Set-ItemProperty -path HKLM:\system\CurrentControlSet\Services\tcpip\parameters -Name 'NV Domain' -Value $Suffix
-
Restart the VM:
Restart-Computer -Force
Reconnect to
vm-edge-a
using RDP and launch PowerShell. -
Mount the Exchange Server distribution:
Mount-DiskImage c:\windows\temp\ExchangeServer2016-x64-cu13.iso
-
Install Edge Transport Server on the
vm-edge-a
server:& D:\Setup.exe /Mode:Install /InstallWindowsComponents /Role:EdgeTransport /IAcceptExchangeServerLicenseTerms /OrganizationName:MyOrg
Configure the Edge Transport server in the ru-central1-b zone
-
Connect to
fsw-vm
using RDP. -
Connect to
vm-edge-b
using RDP. EnterAdministrator
as the username and then your password. Launch PowerShell. -
Create a temporary folder:
mkdir C:\Windows\temp
-
Install ADLDS roles on the server:
Install-WindowsFeature ADLDS
-
Configure the DNS client:
Get-NetAdapter | ` Set-DnsClientServerAddress -ServerAddresses "10.2.0.3,10.1.0.3"
-
Configure remote access to the directory with distributions on
fsw-vm
:$Credential = Get-Credential # Username: yantoso\Administrator New-PSDrive -Name 'fsw-vm' -PSProvider:FileSystem -Root '\\fsw-vm.ru-central1.internal\distrib' -Credential $Credential
Enter
yantoso\Administrator
as the username and then your password. -
Install the dependencies:
& fsw-vm:\vcredist_x64_2012.exe /install /passive /norestart & fsw-vm:\NDP472-KB4054530-x86-x64-AllOS-ENU.exe /install /passive /norestart
-
Copy the Microsoft Exchange distribution to
vm-edge-b
:copy-item fsw-vm:\ExchangeServer2016-x64-cu13.iso c:\windows\temp\ExchangeServer2016-x64-cu13.iso
-
Specify the primary DNS suffix:
$Suffix = 'ru-central1.internal' Set-ItemProperty -path HKLM:\system\CurrentControlSet\Services\tcpip\parameters -Name Domain -Value $Suffix Set-ItemProperty -path HKLM:\system\CurrentControlSet\Services\tcpip\parameters -Name 'NV Domain' -Value $Suffix
-
Restart the VM:
Restart-Computer -Force
Reconnect to
vm-edge-b
using RDP and launch PowerShell. -
Mount the Exchange Server distribution:
Mount-DiskImage c:\windows\temp\ExchangeServer2016-x64-cu13.iso
-
Install Edge Transport Server on
vm-edge-b
:& D:\Setup.exe /Mode:Install /InstallWindowsComponents /Role:EdgeTransport /IAcceptExchangeServerLicenseTerms /OrganizationName:MyOrg
Add Edge Transport servers to Exchange
Each Edge Transport server must subscribe to a website in its own availability zone.
Set up a subscription on the vm-edge-a server
-
Create a folder named
subscribe
:mkdir c:\subscribe
-
Run the Exchange Management Shell. Create a subscription file on
vm-edge-a
:New-EdgeSubscription -FileName "C:\subscribe\$(hostname).xml"
-
Copy
C:\subscribe\vm-edge-a.xml
to theC:\root\vm-edge-a.xml
directory of thevm-exchange-a
server. -
Log in to
vm-exchange-a
and run the Exchange Management Shell. -
Subscribe the
vm-edge-a
Edge Transport server to theru-central1-a
website:New-EdgeSubscription -FileData ([byte[]]$(Get-Content -Path "C:\root\vm-edge-a.xml" -Encoding Byte -ReadCount 0)) -Site "ru-central1-a"
-
Make sure that the subscription is created using the command:
Get-EdgeSubscription
Result:
Name Site Domain ---- ---- ------ vm-edge-a yantoso.net/Confi... ru-central1.internal
-
Check the sync status:
Test-EdgeSynchronization
The
SyncStatus
value must beNormal
.
Set up a subscription on the vm-edge-b server
-
Create a folder named
subscribe
:mkdir c:\subscribe
-
Run the Exchange Management Shell. Create a subscription file on the
vm-edge-b
server:New-EdgeSubscription -FileName "C:\subscribe\$(hostname).xml"
-
Copy
C:\subscribe\vm-edge-b.xml
to theC:\root\vm-edge-b.xml
directory of thevm-exchange-b
server. -
Log in to the
vm-exchange-b
server and run the Exchange Management Shell. -
Subscribe the
vm-edge-b
Edge Transport server to theru-central1-b
website:New-EdgeSubscription -FileData ([byte[]]$(Get-Content -Path "C:\root\vm-edge-b.xml" -Encoding Byte -ReadCount 0)) -Site "ru-central1-b"
-
Make sure that the subscription is created using the command:
Get-EdgeSubscription
Result:
Name Site Domain ---- ---- ------ vm-edge-a yantoso.net/Confi... ru-central1.internal vm-edge-b yantoso.net/Confi... ru-central1.internal
-
Check the sync status:
Test-EdgeSynchronization
The
SyncStatus
value must beNormal
.
How to delete the resources you created
To stop paying for the deployed servers, delete all the VMs and load balancer:
fsw-vm
ad-vm-a
ad-vm-b
vm-exchange-a
vm-exchange-b
vm-edge-a
vm-edge-b
- load balancer
exchange-lb