SOLVED

Is there a way to change O365 group email address using powershell

Deleted
Not applicable

My organization wants to change email address of O365 group.  I am not able to find any power shell to change email address of already created O365 group.   I tried below command but it is not working. 

 

Set-unifiedgroup -identity  testo365 -primarysmtpaddress test123O365@qqq.onmicrosoft.com

 

Can someone please provide your thoughts on this. 

37 Replies

You seem to have one additional "-" character in front of the address, remove it and it should work fine.

I am not using that extra charecter. It was a mistake in my typo. 

So do you get any error when running the cmdlet or?

best response
Solution
If you want to update the Email Address of the Office 365 group, please follow below steps.

O365 Group Name :- Test O365Group
Current Email addres :- test.o365@abcd.onmicrosoft.com
Update to :- test.o365@abcd.com

Follow below script in powershell.

Set-UnifiedGroup -Identity "Test O365Group" -EmailAddresses: @{add="SMTP:test.o365@abcd.com"}

"


@Yahkoob Ayappally wrote:
If you want to update the Email Address of the Office 365 group, please follow below steps.

O365 Group Name :- Test O365Group
Current Email addres :- test.o365@abcd.onmicrosoft.com
Update to :- test.o365@abcd.com

Follow below script in powershell.

@Set-UnifiedGroup -Identity "Test O365Group" -EmailAddresses: @{add="SMTP:test.o365@abcd.com"}

If I use that command, I get the following error:
There are multiple primary SMTP addresses. Please ensure there is only one primary address for each address type."

Hi John,

 

Steps to change Office 365 group Email address:- 

 

Current SMTP address :- test.o365group@abcd.onmicrosoft.com

Required SMTP address :- test.o365group@abcd.com

 

Follow the below steps in power shell using Global Administrator Credentials,

 

1. Connect to Exchange Online via Power shell using Global Administrator Credentials and run the below commends. First two command run separately. 

 

Set-ExecutionPolicy Unrestricted

 

Start-service winrm

 

Import-module MSOnline
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Connect-MsolService -Credential $UserCredential

 

2.  Run the below command to add required SMTP address as an alias.

  Set-UnifiedGroup -Identity "X" -EmailAddresses: @{Add ="Y"}

here X is the Display Name of Office 365 group and Y is the required Email ID.

Set-UnifiedGroup -Identity "Test o365Group" -EmailAddresses: @{Add ="test.o365group@abcd.com"}

 

3. Promote alias as a primary SMTP address,

Set-UnifiedGroup -Identity "Test O365Group" -PrimarySmtpAddress "test.o365group@abcd.com"

 

4. If not required, you can remove first ID using below command.

Set-UnifiedGroup -Identity "Test o365Group" -EmailAddresses: @{Remove="test.o365group@abcd.onmicrosoft.com"}

 

Please note, For updating the Office 365 group SMTP address required Global Administrator access.

 

Thanks and Regards,

Yahkoob Ayappally

Thank you for the post. This worked like a charm. The only thing is the typo "}" that you have in step 3. Everything else works great.
Dear Ryan,

Good Day.

Yes, Thanks for notifying. its typo error, mistakenly added 🙂

Hi, I have a question, I would like to change all existing O365 Groups which have a wrong e-mail address: 

Get-UnifiedGroup -Filter {EmailAddresses -like '*@abd.onmicrosoft.com'} | Set-UnifiedGroup -PrimarySmtpAddress but I Need some variable for the Name before the @, do you have an Idea?


Thanks and best regards,

Luciano

Hai Luciano,

 

Good Day.

 

Yes It is possible, you can add new email ID and you can promote your new Email ID as an SMTP and you can remove your Old Email ID. But performing this steps, you need a global Administrator access.

 

Please follow below Steps to change Office 365 group Email address:- 

 

Current SMTP address :- test.o365group@abcd.onmicrosoft.com

Required SMTP address :- test.o365group@abcd.com

 

Follow the below steps in power shell using Global Administrator Credentials,

 

1. Connect to Exchange Online via Power shell using Global Administrator Credentials and run the below commends. First two command run separately. 

 

Set-ExecutionPolicy Unrestricted

 

Start-service winrm

 

Import-module MSOnline
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Connect-MsolService -Credential $UserCredential

 

2.  Run the below command to add required SMTP address as an alias.

  Set-UnifiedGroup -Identity "X" -EmailAddresses: @{Add ="Y"}

here X is the Display Name of Office 365 group and Y is the required Email ID.

Eg:- Set-UnifiedGroup -Identity "Test o365Group" -EmailAddresses: @{Add ="test.o365group@abcd.com"}

 

3. Promote alias as a primary SMTP address,

Set-UnifiedGroup -Identity "Test O365Group" -PrimarySmtpAddress "test.o365group@abcd.com"

 

4. If not required, you can remove first ID using below command.

Set-UnifiedGroup -Identity "Test o365Group" -EmailAddresses: @{Remove="test.o365group@abcd.onmicrosoft.com"}

 

Please note, For updating the Office 365 group SMTP address required Global Administrator access.Hope this will help you and let me know if you are facing any issue on this.

 

Thanks and Regards,

Yahkoob Ayappally

This works good in principle, using Set-UnifiedGroup to change primary SMTP address, and adding and removing addresses from the EmailAddresses, like in Yahkoob's examples. The unfortunate thing though, if you try to remove an e-mail address, it will not be removed from the Azure AD Group/Exchange group object. You will still see the e-mail address you tried to remove as one of the aliases for the group if you look at the group in the Office 365 Admin portal, or if you look at the proxy addresses using Get-AzureADGroup, Get-AzureADMSGroup or Get-MSOLGroup. There is currently no way you can remove an e-mail address from these groups, so there is an discrepancy between using Set-UnifiedGroup and the group object represented in Exchange Online or Azure AD. Unfortunately, recently I discovered that this proxy addresses also is written back to local AD if you configure Azure AD Connect Group Writeback. This could possibly lead to conflict with local Exchange recipients using the same emailaddress. There really should be a way to remove emailaddresses from Office 365 Groups all the way to prevent conflicts.
Thank you for the post. This worked like a charm.

Thanks for share! works for me amazingly!

cool always welcome Howard 🙂

works like a charm so Thx, one thing it doesn't seem to do I want to change from Capitals to lowercase

WORD@mail.com to word@mail.com

any advice/suggestions?

Hi Susan,

Thanks for your update!!!

I think you don't worry about the capital and small letters, its case sensitive and you can ignore it. I hope you can change the capital to small letters because mail system is considered as a both are same email address. You can spread your group email ID as usual with word@mail.com and you will receive all emails.

Let me know if you have a more query.
Regards,
Yahkoob A
1 best response

Accepted Solutions
best response
Solution
If you want to update the Email Address of the Office 365 group, please follow below steps.

O365 Group Name :- Test O365Group
Current Email addres :- test.o365@abcd.onmicrosoft.com
Update to :- test.o365@abcd.com

Follow below script in powershell.

Set-UnifiedGroup -Identity "Test O365Group" -EmailAddresses: @{add="SMTP:test.o365@abcd.com"}

View solution in original post