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. You will install two Microsoft Exchange mail servers, two Active Directory servers, and two Edge Transport servers in ru-central1-a
and ru-central1-b
availability zones. A network load balancer will distribute load across the servers. To manage the servers, you will use a separate VM with internet access hosted 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).
- Fee for outbound 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 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 subnets in
exchange-network
: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: IP address and subnet 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 you create 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
You can read more about the best practices for securing Active Directory on the MS 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 selectVirtual machine instance
. -
Under Boot disk image:
- Go to the Custom tab.
- Click Select and select Create new in the window that opens.
- In the Contents field, select
Image
and then select the Windows Server 2016 Datacenter image from the list below. For more information on how to upload your own image for Microsoft products, see the Importing required image section. - (Optional) In the Additional field, enable Delete along with the virtual machine if you need to automatically delete this disk when deleting the VM.
- Click Add disk.
-
Under Location, select the
ru-central1-a
availability zone. -
Under Disks and file storages, enter
50 GB
as your boot disk size. -
Under Computing resources, navigate to the
Custom
tab and specify the required platform, number of vCPUs, and amount of RAM:- Platform:
Intel Ice Lake
. - vCPU:
4
. - Guaranteed vCPU performance:
100%
. - RAM:
8 GB
.
- Platform:
-
Under Network settings, specify:
- Subnet:
exchange-subnet-a
. - Public IP:
No address
.
- Subnet:
-
Under General information, specify the VM name:
ad-vm-a
. -
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 exchange-subnet-b
.
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 selectVirtual machine instance
. -
Under Boot disk image:
- Go to the Custom tab.
- Click Select and select Create new in the window that opens.
- In the Contents field, select
Image
and then select the Windows Server 2016 Datacenter image from the list below. For more information on how to upload your own image for Microsoft products, see the Importing required image section. - (Optional) In the Additional field, enable Delete along with the virtual machine if you need to automatically delete this disk when deleting the VM.
- Click Add disk.
-
Under Location, select the
ru-central1-d
availability zone. -
Under Disks and file storages, enter
50 GB
as your boot disk size. -
Under Computing resources, navigate to the
Custom
tab and specify the required platform, number of vCPUs, and amount of RAM:- Platform:
Intel Ice Lake
. - vCPU:
2
. - Guaranteed vCPU performance:
100%
. - RAM:
4 GB
.
- Platform:
-
Under Network settings:
- In the Subnet field, select
exchange-subnet-d
. - In the Public IP field, leave
Auto
.
- In the Subnet field, select
-
Under General information, specify the VM name:
fsw-vm
. -
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
Active Directory VMs do not have internet access. To configure them, use the fsw-vm
VM through RDP.
-
Connect to
fsw-vm
through RDP. UseAdministrator
for username, and your password. -
On
fsw-vm
, run RDP and connect toad-vm-a
. UseAdministrator
for username, and your password. -
On
ad-vm-a
, 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 will restart automatically. After it restarts, connect to
ad-vm-a
using theyantoso\Administrator
account and your password. Relaunch PowerShell. -
Rename the default site to
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
through RDP. UseAdministrator
for username, and your password. -
On
fsw-vm
, run RDP and connect toad-vm-b
. UseAdministrator
for username, and 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 will restart automatically. After it restarts, connect to
ad-vm-b
using 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 run 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 will restart automatically. After it restarts, connect to
fsw-vm
using theyantoso\Administrator
account and your password. Relaunch PowerShell. -
Create the
distrib
folder: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
.
Place the distributions in the
C:\distrib
directory. - .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 selectVirtual machine instance
. -
Under Boot disk image:
- Go to the Custom tab.
- Click Select and select Create new in the window that opens.
- In the Contents field, select
Image
and then select the Windows Server 2016 Datacenter image from the list below. For more information on how to upload your own image for Microsoft products, see the Importing required image section. - (Optional) In the Additional field, enable Delete along with the virtual machine if you need to automatically delete this disk when deleting the VM.
- Click Add disk.
-
Under Location, select the
ru-central1-a
availability zone. -
Under Disks and file storages:
- Set the boot disk size:
100 GB
. - Click Add and add another
250 GB
SSD nameddb-a
.
- Set the boot disk size:
-
Under Computing resources, navigate to the
Custom
tab and specify the required platform, number of vCPUs, and amount of RAM:- Platform:
Intel Ice Lake
. - vCPU:
8
. - Guaranteed vCPU performance:
100%
. - RAM:
32 GB
.
- Platform:
-
Under Network settings, specify:
- Subnet:
exchange-subnet-a
. - Public IP:
No address
.
- Subnet:
-
Under General information, specify the VM name:
vm-exchange-a
. -
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
through RDP. -
On
fsw-vm
, run RDP and connect tovm-exchange-a
. UseAdministrator
for username, and 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 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 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 selectVirtual machine instance
. -
Under Boot disk image:
- Go to the Custom tab.
- Click Select and select Create new in the window that opens.
- In the Contents field, select
Image
and then select the Windows Server 2016 Datacenter image from the list below. For more information on how to upload your own image for Microsoft products, see the Importing required image section. - (Optional) In the Additional field, enable Delete along with the virtual machine if you need to automatically delete this disk when deleting the VM.
- Click Add disk.
-
Under Location, select the
ru-central1-b
availability zone. -
Under Disks and file storages:
- Set the boot disk size:
100 GB
. - Click Add and add another
250 GB
SSD nameddb-b
.
- Set the boot disk size:
-
Under Computing resources, navigate to the
Custom
tab and specify the required platform, number of vCPUs, and amount of RAM:- Platform:
Intel Ice Lake
. - vCPU:
8
. - Guaranteed vCPU performance:
100%
. - RAM:
32 GB
.
- Platform:
-
Under Network settings, specify:
- Subnet:
exchange-subnet-b
. - Public IP:
No address
.
- Subnet:
-
Under General information, specify the VM name:
vm-exchange-b
. -
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
through RDP. -
On
fsw-vm
, run RDP and connect tovm-exchange-b
. UseAdministrator
for username, and 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 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 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
through RDP. -
Grant the
yantoso\Exchange Trusted Subsystem
group administrator permissions forfsw-vm
:Add-LocalGroupMember -Group 'Administrators' -Member 'yantoso\Exchange Trusted Subsystem'
Create disks for VM databases
-
On
fsw-vm
, run RDP and connect tovm-exchange-a
. Useyantoso\Administrator
for username, and 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 vm-exchange-b
.
Configure the database availability group
-
On
fsw-vm
, run RDP and connect tovm-exchange-a
using RDP. Useyantoso\Administrator
for username, and 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 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 the load balancer name:
exchange-lb
. - In the Public address field, select Auto.
- Click Add listener under Listeners.
- Enter the listener name:
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 the target group name:
exchange-tg
. - Select
vm-exchange-a
andvm-exchange-b
and click Create. - Click Configure.
- Enter the health check name:
exchange-hc
. - 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=<vm-exchange-a_IP_address>,subnet-id=<vm-exchange-a_subnet_ID> \ --target address=<vm-exchange-b_IP_address>,subnet-id=<vm-exchange-b_subnet_ID>
-
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'
All new mailboxes will automatically get an alias with the @yantoso.net
domain.
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 selectVirtual machine instance
. -
Under Boot disk image:
- Go to the Custom tab.
- Click Select and select Create new in the window that opens.
- In the Contents field, select
Image
and then select the Windows Server 2016 Datacenter image from the list below. For more information on how to upload your own image for Microsoft products, see the Importing required image section. - (Optional) In the Additional field, enable Delete along with the virtual machine if you need to automatically delete this disk when deleting the VM.
- Click Add disk.
-
Under Location, select the
ru-central1-a
availability zone. -
Under Disks and file storages, enter
50 GB
as your boot disk size. -
Under Computing resources, navigate to the
Custom
tab and specify the required platform, number of vCPUs, and amount of RAM:- Platform:
Intel Ice Lake
. - vCPU:
4
. - Guaranteed vCPU performance:
100%
. - RAM:
8 GB
.
- Platform:
-
Under Network settings:
- In the Subnet field, select
exchange-subnet-a
. - Leave the Public IP field set to
Auto
or selectList
and the public IP address from the list if you reserved one earlier.
- In the Subnet field, select
-
Under General information, specify the VM name:
vm-edge-a
. -
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 selectVirtual machine instance
. -
Under Boot disk image:
- Go to the Custom tab.
- Click Select and select Create new in the window that opens.
- In the Contents field, select
Image
and then select the Windows Server 2016 Datacenter image from the list below. For more information on how to upload your own image for Microsoft products, see the Importing required image section. - (Optional) In the Additional field, enable Delete along with the virtual machine if you need to automatically delete this disk when deleting the VM.
- Click Add disk.
-
Under Location, select the
ru-central1-b
availability zone. -
Under Disks and file storages, enter
50 GB
as your boot disk size. -
Under Computing resources, navigate to the
Custom
tab and specify the required platform, number of vCPUs, and amount of RAM:- Platform:
Intel Ice Lake
. - vCPU:
4
. - Guaranteed vCPU performance:
100%
. - RAM:
8 GB
.
- Platform:
-
Under Network settings:
- In the Subnet field, select
exchange-subnet-b
. - Leave the Public IP field set to
Auto
or selectList
and the public IP address from the list if you reserved one earlier.
- In the Subnet field, select
-
Under General information, specify the VM name:
vm-edge-b
. -
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
through RDP. -
Connect to
vm-edge-a
through RDP. UseAdministrator
for username, and 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 distribution folder located on the
fsw-vm
server:$Credential = Get-Credential # Username: yantoso\Administrator New-PSDrive -Name 'fsw-vm' -PSProvider:FileSystem -Root '\\fsw-vm.ru-central1.internal\distrib' -Credential $Credential
Enter the
yantoso\Administrator
username and 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
via RDP and run 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
through RDP. -
Connect to
vm-edge-b
through RDP. UseAdministrator
for username, and 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 distribution folder located on the
fsw-vm
server:$Credential = Get-Credential # Username: yantoso\Administrator New-PSDrive -Name 'fsw-vm' -PSProvider:FileSystem -Root '\\fsw-vm.ru-central1.internal\distrib' -Credential $Credential
Enter the
yantoso\Administrator
username and 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-b
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-b
via RDP and run PowerShell. -
Mount the Exchange Server distribution:
Mount-DiskImage c:\windows\temp\ExchangeServer2016-x64-cu13.iso
-
Install Edge Transport Server on the
vm-edge-b
server:& 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 the
subscribe
folder:mkdir c:\subscribe
-
Run the Exchange Management Shell. Create a subscription file on the
vm-edge-a
server:New-EdgeSubscription -FileName "C:\subscribe\$(hostname).xml"
-
Copy the
C:\subscribe\vm-edge-a.xml
file to thevm-exchange-a
server to theC:\root\vm-edge-a.xml
folder. -
Log in to the
vm-exchange-a
server 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
parameter should change toNormal
.
Set up a subscription on the vm-edge-b server
-
Create the
subscribe
folder: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 the
C:\subscribe\vm-edge-b.xml
file to thevm-exchange-b
server, theC:\root\vm-edge-b.xml
folder. -
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
parameter should change toNormal
.
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
exchange-lb
load balancer