O365 – How To Add Proxy Addresses To AD Groups From CSV File With PowerShell

When using Azure AD Connect with Office 365, you will find that many of the mailbox and distribution group attributes cannot be set in the Office 365 portal.  When you try to update the attributes, you will see an error such as the one shown here:Update Error
Since this is an attribute that is synchronized from AD via AAD Connect, it must be updated in Active Directory and the new values will then be synchronized to the Office 365 Portal.

I recently needed to add a second e-mail address alias to a number of distribution groups.  Below are the steps I took using PowerShell to update the groups.

1. Create a CSV file with two columns, Name and ProxyAddresses.  Populate the appropriate cells with the distribution group name and the proxy addresses separated by a semi-colon.  The proxy address with the capitalized SMTP will be the primary e-mail address for the group and will be used as the ‘sent from’ address.  Save the file and note the file location.CSV File

2.  Create a PowerShell script as follows changing the file name and location as needed:

Import-Csv C:\Scripts\DistGroups.csv | ForEach-Object{
  $name = $_.Name
  $proxy = $_.ProxyAddresses -split ';'
  Set-ADGroup -Identity $name -Add @{proxyAddresses= $proxy}

3.  Run the script.  Open a distribution group in AD, navigate to the Attribute Editor tab and scroll down to the proxyAddresses attribute.  Both  e-mail addresses will show.ProxyAddresses

4.  In the O365 Exchange Admin Center, navigate to Recipients > Groups.  Edit the distribution group and select the E-mail Options page to see that both the e-mail addresses are showing.