How to Bulk Change Primary SMTP Addresses in Microsoft 365
Question details
The user needs to update the primary SMTP addresses for specific Microsoft 365 users using a CSV file after a new domain was added.

- Product
- Microsoft 365
- Device & OS
- not provided
- Scenario
- Updating user email domains in bulk via a prepared CSV file without affecting non-targeted users.
- Observed behavior
- Selected users require new primary SMTP addresses to be successfully assigned via automated commands or batch processes.
Ensure you have Exchange Administrator or Global Administrator privileges in Microsoft 365, and verify whether directory synchronization is enabled, as this dictates where the changes must be made.
Bulk Update SMTP Addresses Using PowerShell and CSV
Use the Exchange Online PowerShell module to read a CSV file and loop through specific users to update their primary SMTP addresses.
This method requires connecting to Microsoft 365 via PowerShell. Ensure your CSV file has clear headers, such as 'CurrentUPN' for the existing address and 'NewUPN' for the target address.
Create and save a CSV file containing only the users that should be updated. Include columns mapping the current User Principal Name to the new primary SMTP address.
Open an elevated PowerShell window and run the 'Connect-ExchangeOnline' cmdlet to authenticate with your Microsoft 365 administrator credentials.
Execute a script that imports the CSV using 'Import-Csv' and pipes it into a 'ForEach' loop. Inside the loop, use the 'Set-MsolUserPrincipalName' or 'Set-Mailbox' cmdlet to assign the new addresses based on the CSV data.

Update Domains in Microsoft 365 Admin Center
Change user email domains in batches directly through the Microsoft 365 admin portal interface.
Looking for a Lightweight Office Suite for Your Organization?
While managing Exchange and Microsoft 365 infrastructure, you might also be looking for a cost-effective productivity suite for your users. WPS Office provides a free, lightweight, and familiar alternative to Microsoft Office that is fully compatible with standard document formats.

Frequently Asked Questions
Can I change the primary SMTP address without changing the User Principal Name (UPN)?
Yes, you can use the Set-Mailbox cmdlet with the EmailAddresses parameter in PowerShell to modify SMTP addresses independently of the UPN, though Microsoft generally recommends keeping them matched for a seamless login experience.
What happens to the old email addresses after a bulk SMTP update?
By default, the previous primary SMTP addresses are kept as secondary proxy addresses (aliases). This ensures that users will continue to receive emails sent to their old domain.
Why are my PowerShell changes reverting or not syncing?
If you are in a hybrid environment with authoritative directory synchronization (Azure AD Connect), you must make the SMTP changes in your on-premises Active Directory. Changes made directly in Microsoft 365 will be overwritten during the next sync cycle.




