Alibaba Cloud Mail AD sync and authentication
For enterprises that use self-hosted email systems with Microsoft Exchange, the AD system serves as the authentication platform. As the office information hub, AD accounts are linked to numerous applications and are a critical component. This document describes how to sync AD accounts to create an organizational structure in Alibaba Cloud Mail. This process enables a smooth email system migration, allows users to log in with their AD account credentials, and helps achieve unified account management. 

1. Sync rules and considerations
1. Sync targets include OUs, user accounts, distribution groups, and their members.
2. You can sync an entire Domain Controller (DC) or a specific OU. If you only want to sync a specific root OU, ensure that objects you do not want to sync are not placed under it. Alternatively, you can exclude objects by adding the nombx string to the url attribute of an OU, or the wWWHomePage attribute of a user or security group. Note that you cannot exclude individual distribution groups under a synced OU; all of them are synced.
3. The sync process performs only add, disable, and update operations. It cannot delete email accounts, mail groups, or departments. For example, changing the sAMAccountName value is equivalent to unlinking the original email account and creating a new email account based on the new sAMAccountName value.
4. The cn attribute in AD is mapped to the "Default nickname" in Alibaba Cloud Mail, which is visible internally. When you send an email to a user in the same domain, the sender's name appears as "Name (Default Nickname)". The displayName attribute is mapped to the "Custom nickname," which is visible externally. When you send an email to an external recipient, the sender's name is the "Custom nickname".
We do not recommend syncing the
mailattribute if the domain administrator needs to add more than two account aliases. After syncing the ADmailattribute, AD becomes the source of truth. Any aliases added in Alibaba Cloud Mail will be overwritten, leaving only the alias address synced from the ADmailattribute.If you need to use multiple independent domains, add the other subdomains in the domain administration console before you set up AD sync. Then, create a multi-domain account before starting the sync. If you set up AD sync before adding multi-domain subdomains, deleted accounts cannot be recovered. If you need to back up historical data, use the email transfer feature. For more information, see Mail Recycle Bin.
The sync cycle is typically measured in minutes, with a maximum interval of one hour. Syncing 1,000 accounts takes approximately 5 minutes. Ensure that your AD server's time is accurate. If you have multiple AD servers that sync with each other, ensure that the AD server that syncs with Alibaba Cloud Mail has the latest changes for timely incremental syncs.
To ensure that the mailboxes of off-boarded employees are promptly frozen, we strongly recommend maintaining a dedicated OU for them. Disable the AD accounts of these employees.
This practice allows you to manage their deletion collectively later and ensures that their email accounts are frozen immediately. Even if the employee remains logged in to an email app, they cannot send or receive emails.
When an account is deleted and then recreated with the same name in AD, the sync process handles the potential duplication. It first checks if the original email
account exists. If it does, the account is renamed with a
_backupsuffix. Then, the new email account corresponding to the new AD account is created.For example, if you delete the AD account
user@a.comand then create a newuser@a.comin AD, the mail service first renames the old mailbox touser_backup@a.comand then creates a new mailbox foruser@a.com.
Supported attributes 1. The following attributes are synced by default. Except for the account name, other attributes are customizable and can be mapped to any AD attribute. 2. These attributes can also be excluded from the sync on request. | |
AD | Alibaba Cloud Mail |
cn | Name |
sAMAccountName | Account name, which is the prefix of the default email address. |
title | Title |
telephoneNumber | Work phone |
mobile | Mobile |
Domain alias/Account alias/Independent multi-domain account | |
displayName | Custom nickname (The sender's name displayed to external recipients.) |
No default corresponding attribute | Default nickname (Visible to accounts within the enterprise.) |
No default corresponding attribute | Employee ID |
Group sync notes | |
Distribution group | Security group |
The | The |
The Name can contain Chinese characters. | The Name can contain Chinese characters. |
The | The |
The group scope can be Global or Universal. | The group scope can be Global or Universal. |
Group members can be synced. | Group members can be synced. |
External group members must have the | External group members must have the |
2. Authentication rules and considerations
After you set up AD authentication, the authentication authority shifts from Alibaba Cloud Mail to your AD system. When a user enters their account and password on a client or web portal, Alibaba Cloud Mail uses the LDAP protocol to query your AD service. The AD system validates the account and password. If the credentials are correct, the AD system notifies Alibaba Cloud Mail to grant access.
1. You must create a postmaster account in AD. The value of the userPrincipalName attribute for this account must be identical to the postmaster email address in Alibaba Cloud Mail. Otherwise, the administrator cannot log in to the admin mailbox after authentication is enabled.
2. The AD server address and port must be accessible from the public network for Alibaba Cloud Mail to connect. To enhance your AD service security, you can set up an access control list (ACL) to allow access only from the source IP ranges: 115.124.XX.XX and 59.82.XX.XX.
If you use AD for authentication, all login and password modification operations are handled by your AD server. If your AD system is unavailable, users cannot log in to their mailboxes. Alibaba Cloud Mail supports an active-standby AD configuration for authentication to prevent service disruption if one server fails.
3. Implementation scenarios
Alibaba Cloud Mail supports three scenarios: sync only, authentication only, and both sync and authentication. There are slight differences and important considerations for each scenario.
Scenario | Differences |
Sync only | 1. A user's 2. Passwords are not synced. Synced email accounts are created without a password. The administrator must set a password in the Alibaba Cloud Mail admin console before users can log in. Important Be cautious when switching scenarios. If you are changing from "both sync and authentication" to "sync only," prepare in advance. |
Authentication only | 1. For all users who require authentication, if the Important Be cautious when switching scenarios. If you are changing from "both sync and authentication" to "authentication only," prepare in advance. 2. Users must log in with their AD account password. Passwords set in the Alibaba Cloud Mail console will not work. |
Both sync and authentication | 1. Except for the 2. Users must log in with their AD account password. Passwords set in the Alibaba Cloud Mail console will not work. |
4. Retrieve attributes
Open Active Directory Users and Computers. On the View menu, select Advanced Features. Otherwise, you cannot view the attributes of AD objects.
Right-click a department, user, or mail group object, select Properties, and then go to the Attribute Editor tab to find the required attributes.
Tip: You can quickly find an attribute by clicking any attribute and then typing the first letter of the desired attribute.
5. Tips
If you experience a significant sync delay where new departments, accounts, or mail groups do not appear in Alibaba Cloud Mail, you can trigger a sync by refreshing a non-critical attribute that is not related to sync or authentication. If many objects are affected, you can also use the following commands for bulk operations.
Method 1: Use the command prompt directly
csvde -f C:\Users\Administrator\Desktop\20210908.csv -r "(objectClass=user)" -d "OU=SmallOU,OU=LargeOU,DC=xxx,DC=com" -l "sAMAccountName,Mail"
Note: Some special values, such as wWWHomePage, cannot be exported directly. To modify them, you can use the Import-Csv command as shown in Method 2.
Method 2: Use the Active Directory module for PowerShell
In Administrative Tools, open the Active Directory module for Windows PowerShell. Alternatively, open Command Prompt, type PowerShell and press Enter, and then run import-module activedirectory to import the AD module.
Bulk modify account attributes from an exported CSV file
Import-Csv -Path C:\Users\Administrator\Desktop\20210908.csv | foreach {Get-ADUser -Identity $_.sAMAccountName | Set-ADUser -EmailAddress $_.mail -HomePage $_.wWWHomePage }