Exchange Server
The Exchange source migrates an on-premises Exchange Server. Vandelay reads every mailbox over Exchange Web Services (EWS), signed in as one service account that impersonates each mailbox, so no user password is needed. It reads the users, groups, resources and forwarding from Active Directory, or takes the mailboxes from an accounts CSV when the directory is not available. It writes nothing on the source, although Exchange may initialise a mailbox that has never been opened when Vandelay reads it for the first time.
The fitting strategy is a one-shot migration: every account is copied while users keep working on Exchange, and each domain moves at once with its MX records and client settings. Microsoft 365 has its own source, described in Microsoft 365.
Migrated data
Section titled “Migrated data”Mail, calendars and contacts of each mailbox are read over EWS, with recurring events and their exceptions, and contacts with their photos. Tasks, notes and journal entries are not read. The mailbox’s inbox rules, read with EWS GetInboxRules, become Stalwart mail rules, and what a rule does that Stalwart cannot express is reported as a loss. The automatic reply (out of office) becomes the account’s vacation response, and forwarding set in Active Directory becomes a forwarding rule.
From Active Directory, Vandelay reads every mailbox user with its addresses (proxyAddresses), display name, quota and disabled state, the distribution groups and mail-enabled security groups with their members, and room and equipment mailboxes with their capacity. Shared mailboxes become Stalwart groups, and pre-flight notes that Send As and Send on Behalf rights are not migrated, because the members of a Stalwart group can send from its address. Mail contacts and mail users are not created on Stalwart, but distribution lists still reach their addresses.
With an accounts CSV instead of Active Directory, Vandelay migrates only the mailboxes in the file, with the aliases and quotas the file gives. Forwarding, group members, disabled accounts and the recipients that inbox rules name inside the organisation are then not read, and discovery reports each of these as a loss.
Exchange exposes no password hashes, so every account gets a temporary password, or signs in through an external identity provider, as chosen in Passwords. No DKIM keys are read either; provisioning generates new ones, as described in DKIM keys.
Source preparation
Section titled “Source preparation”Prepare Exchange in four steps. The same steps are printed by vandelay migrate guide exchange and shown beside the Source: access step in the web and terminal interfaces.
-
Turn on Basic authentication for EWS. Vandelay signs in to EWS with Basic authentication over HTTPS, which many installations have turned off on the EWS virtual directory. Turn it on, for the duration of the migration, on each Exchange server that answers the EWS URL:
Terminal window Set-WebServicesVirtualDirectory -Identity "<server>\EWS (Default Web Site)" -BasicAuthentication $trueTurn it off again with
-BasicAuthentication $falseonce the migration is done. -
Create the service account and let it impersonate the migrated mailboxes. Give a dedicated account the
ApplicationImpersonationrole, limited by a management scope to the mailboxes being migrated, so that it cannot open any other mailbox of the organisation. With the migrated users in a group, the following commands create the scope and the role assignment:Terminal window New-ManagementScope -Name vandelay-users `-RecipientRestrictionFilter "MemberOfGroup -eq 'CN=Migrate,OU=Groups,DC=example,DC=org'"New-ManagementRoleAssignment -Name vandelay-impersonation `-Role ApplicationImpersonation -User vandelay -CustomRecipientWriteScope vandelay-usersThe
MemberOfGroupfilter takes the group’s distinguished name, and works only with groups that Exchange recognises, as Filterable properties for the RecipientFilter parameter describes; New-ManagementScope lists the other forms of a scope. Exchange refuses to let Vandelay read a mailbox outside the scope. Vandelay only reads through the role; remove the assignment once the migration is done. -
Give Vandelay the organisation, from Active Directory or from a CSV. For Active Directory, Vandelay needs a domain controller reachable over
ldaps://, or overldap://with StartTLS, and signs in there as the service account, with the same password; a domain user’s read access is enough. A domain controller lists only its own domain, so the recipients of another domain of the forest need their own project, unless the URL names a Global Catalog whose base covers that domain. Without directory access, write an accounts CSV with one row per mailbox; itspasswordandlogincolumns are refused, because every mailbox is read by impersonation. -
Pin self-signed certificates. When Exchange presents its own self-signed certificate, note its SHA-256 fingerprint for “Source certificate pin (SHA-256)” (
source.tls.sha256,--source-tls-pin), which applies to the host of the EWS URL, as described in Certificate pins. The pin covers every port of that host, so every HTTPS service that Vandelay reaches under that host name must present the pinned certificate. The domain controller has a pin of its own, “Directory certificate pin” (source.ldap.tls.sha256,--ldap-tls-pin), for a certificate not signed by a trusted authority.
Plan settings
Section titled “Plan settings”The connection is “EWS URL” (source.ews, --ews-url), the https://<exchange host>/EWS/Exchange.asmx address of the server; an address with user information, a query or a fragment is refused. “Service account” (source.user, --service-user) is the account’s sign-in name, as DOMAIN\user or user@domain, and its password is a reference in “Master, admin or service account password” (--master-password), stored in the file as source.password.
The organisation comes from exactly one place. “Active Directory URL” (source.ldap.url, --ldap-url) names the domain controller and “Directory base” (source.ldap.base, --ldap-base) the distinguished name to search under, such as DC=example,DC=org; “Directory certificate pin” (source.ldap.tls.sha256, --ldap-tls-pin) pins its certificate. “Accounts CSV” (source.accounts, --accounts) replaces the three. The EWS URL, the directory URL and the base are bound once work starts, so another domain of the forest needs a new project. The Source section of the plan reference lists every key.
The following command sets an Exchange source that reads the organisation from Active Directory:
vandelay migrate source --system=exchange \ --ews-url=https://exchange.example.org/EWS/Exchange.asmx \ --master-password=env:VANDELAY_EXCHANGE_PASSWORD \ --ldap-url=ldaps://dc1.example.org \ --ldap-base=DC=example,DC=orgThe same settings in plan.toml:
[source]system = "exchange"ews = "https://exchange.example.org/EWS/Exchange.asmx"password = "env:VANDELAY_EXCHANGE_PASSWORD"ldap = { url = "ldaps://dc1.example.org", base = "DC=example,DC=org" }The connection test on the Source: access step does not contact Exchange or the domain controller. It reports the source server was not contacted: for this system the first connection is made by Discover (next step), so a wrong URL, password or scope first shows up when Discover runs, and the impersonation of each selected mailbox is tested by pre-flight.
Items not migrated
Section titled “Items not migrated”Discovery reports these losses for every Exchange project, and pre-flight lists them under “Items that cannot be migrated”:
- FullAccess and Send As permissions:
Exchange FullAccess and Send As permissions (who can open or send as a shared mailbox) are not migrated; grant them again on the target. A shared mailbox’s group therefore has no members on Stalwart until they are added. - Folder permissions and delegates (Send on Behalf), which are shared again on Stalwart.
Outlook signatures, junk mail lists (safe and blocked senders) and room booking policies are not migrated.- Client-only Outlook rules, which run only in Outlook and cannot be read from the server. On Exchange 2007, and 2010 before SP1,
GetInboxRulesis refused and no inbox rule is migrated. tasks, notes and journal entries are not migrated; only mail, calendars and contacts are read.- The archive folder role:
the archive folder role is not carried; Archive migrates as a plain folder. - Archive mailboxes and public folders, described below.
The directory adds losses of its own: dynamic distribution groups, whose members a recipient filter computes (dynamic distribution group <name> is not migrated, because a recipient filter computes its members; create it on the target), recipients of a type Vandelay cannot tell, directory entries without a valid address, and forwarding that Active Directory cannot resolve to an email address.
Archive mailboxes and public folders
Section titled “Archive mailboxes and public folders”The server migration reads only each user’s primary mailbox. Archive mailboxes and public folders are copied afterwards with the per-account commands, the EWS importer and the export, into the accounts that the migration created. The following commands copy Alice’s archive mailbox with the same service account:
export VANDELAY_PASSWORD='<service account password>'vandelay import exchange-ews \ --url https://exchange.example.org/EWS/Exchange.asmx \ --mailbox-kind archive \ alice-archive.sqlite
export VANDELAY_PASSWORD='<Stalwart administrator password>'vandelay export \ --url https://mail.example.org \ --auth-basic admin \ alice-archive.sqliteEach store is a separate archive, and the export matches its folders with those the account already has, by role and by parent and name. --mailbox-kind public-folders reads the organisation’s public folder hierarchy in the same way, into an account chosen to hold it.
Troubleshooting
Section titled “Troubleshooting”Service account may not impersonate a mailbox
Section titled “Service account may not impersonate a mailbox”The copy of an account fails with the service account may not impersonate this mailbox; add the mailbox to the management scope of the service account's ApplicationImpersonation role.
The mailbox is outside the management scope of the role assignment. Add the user to the group that the scope filters on, or deselect the account.
Active Directory refuses the service account
Section titled “Active Directory refuses the service account”Discovery stops with Active Directory refused the service account's sign-in; check the source user and password.
The domain controller rejected the bind. Check “Service account” and its password, and that the account can sign in to the domain; the same password serves EWS and the directory.
Directory too large
Section titled “Directory too large”Discovery stops with Active Directory lists more than 1000000 recipients; use an account list instead.
Vandelay reads at most 1,000,000 directory records under the base, and at most 1,000,000 members of one group, and the same message reports either limit. List the mailboxes to migrate in an accounts CSV instead.