The key to supporting multiple email aliases is managing proxy addresses. This ensures mail routing in hybrid environments, and facilitates smooth transitions during Exchange or Microsoft 365 migrations. PowerShell helps you add proxy addresses using the Set-ADUser cmdlet. However, the cmdlet has certain limitations that lead to repetitive effort and require advanced technical skills. This article explains three easy ways to add proxy addresses to users in AD.
A proxy address (or email alias) is an alternative email address assigned to a user's mailbox in AD or Exchange. It allows the user to receive emails sent to multiple addresses within the same mailbox. Proxy addresses are essential for managing multiple domains, ensuring mail delivery, and maintaining compatibility in hybrid or migration setups.
In AD, these addresses are stored in the proxyAddresses attribute, a multi-valued property that can include different address types such as SMTP, X500, and SIP addresses. When objects are synced to Microsoft Entra ID, the values from the mail or proxyAddresses attributes are copied and used in a process called proxy calculation. This process determines the final set of proxy addresses in Entra ID based on various aspects of the on-premises directory data.
Import-Module ActiveDirectory
Use the Set-ADUser cmdlet with the -Add parameter to add a new proxy address to the proxyAddresses attribute. This ensures that existing proxy addresses are not overwritten.
This example below adds "john.doe.alias@example.com" as a secondary proxy address for the user "JohnDoe":
Set-ADUser -Identity "JohnDoe" -Add @{proxyAddresses="smtp:john.doe.alias@example.com"}
Appends two new SMTP proxy addresses for "jdoe" without affecting existing ones.
Set-ADUser -Identity "jdoe" -Add @{'proxyAddresses'=("smtp:jdoe.sales@corp.com","smtp:jdoe.support@corp.com")}
Adds a unique sales alias for every user in the Sales OU based on their account name.
Get-ADUser -Filter * -SearchBase "OU=Sales,DC=domain,DC=com" | ForEach-Object {
Set-ADUser -Identity $_.SamAccountName -Add @{'proxyAddresses'="smtp:$($_.SamAccountName).sales@corp.com"}
}
Imports a CSV file "users.csv" with a list of users including sAMAccountName and ProxyAddressToAdd columns.
Import-Csv -Path "C:\path\to\users.csv" | ForEach-Object {
$userSAM = $_.sAMAccountName
$newProxy = $_.ProxyAddressToAdd
Set-ADUser -Identity $userSAM -Add @{proxyAddresses=$newProxy}
}
Sets a primary proxy address using the Set-Mailbox cmdlet.
Set-Mailbox -Identity "JohnDoe" -PrimarySmtpAddress "john.doe.new.primary@example.com"
The following essential parameters can be used while modifying proxy addresses:
| Parameters | Description |
|---|---|
| -Identity | Specifies the user account to modify. |
| -Add | Hashtable of attributes (like proxyAddresses) to append. |
| -Replace | Replaces existing proxyAddresses with the supplied array. |
| -Remove | Removes proxy addresses from the user. |
| -Filter | Query syntax to find users by conditions. |
| -SearchBase | Limits scope to a specific OU/container. |
The Active Directory Users and Computers (ADUC) console provides a graphical interface to add a proxy address to a user:
ADManager Plus is an all-in-one AD, Exchange, and Microsoft 365 management solution that lets you add proxy addresses to a single user or multiple users in bulk.
Although powerful, relying solely on PowerShell and ADUC can present challenges:
ADManager Plus is a web-based AD and Microsoft Entra ID management and reporting tool that simplifies AD user management and more from a centralized interface:
SMTP (Simple Mail Transfer Protocol) defines how emails are sent between mail servers. Each user's mailbox in Exchange or AD uses an SMTP address, the unique identifier for sending and receiving emails. The primary SMTP address is the user's main email address, while additional proxy addresses (secondary SMTP addresses) let the user receive emails sent to other aliases within the same mailbox.
The primary SMTP address is the main email address associated with a user's mailbox in AD or Exchange. It is the address that appears in the “From” field when a user sends an email. While users can have multiple proxy addresses, the primary SMTP address uniquely identifies the mailbox and handles outbound mail communication.
The difference is case-sensitive. SMTP: (uppercase) denotes the primary email address, while smtp: (lowercase) denotes a secondary address. In systems like Microsoft Exchange, the primary address is the default reply address, and all secondary addresses are used for receiving email but will not be the default for replies.