Change O365 group email address using powershell

Copper Contributor

I am trying to change primarty SMTP of Office365 group but getting error:

 

We failed to update the unified group. Please try again later.
+ CategoryInfo : NotSpecified: (:) [Set-UnifiedGroup], TaskException
+ FullyQualifiedErrorId : [Server=CY4PR06MB3173,RequestId=3179c7a9-9182-449c-9bb1-d1a85e266ac1,TimeStamp=11/30/2017 1:22:37 AM] [FailureCategory=Cmdlet-TaskException] 64E
F00B1,Microsoft.Exchange.Management.RecipientTasks.SetUnifiedGroup
+ PSComputerName : ps.outlook.com

 

I am following steps mentioned in https://techcommunity.microsoft.com/t5/Office-365-Groups/Is-there-a-way-to-change-O365-group-email-a... but no luck. Any help? 

 

The cmdlet i am running is :

Set-UnifiedGroup car@abc.onmicrosoft.com -EmailAddresses:@{add="car@domain.com"}

Set-UnifiedGroup car@abc.onmicrosoft.com -PrimarySmtpAddresses "car@domain.com"

 

 

37 Replies

This first example will add the alias as secondary, not primary. You only need the second one, although the parameter name should be -PrimarySmtpAddress, not -PrimarySmtpAddresses. In any case, this looks like a temporary glitch, so try rerunning the cmdlet.

Hi Vasil, 

That was just typo for primarysmtp. I am still getting this error and i am getting this error since long. Can't change primary smtp. 

You can always open a support case and have it properly investigated.

Hi Hasan

 

As Vasil mentions, if all you're looking to do is to add a new email address as the primary SMTP address of the group, then you can achieve it by just using the -PrimarySmtpAddress option in Set-UnifiedGroup cmdlet.

Hello,

 

We ran into this as well and did open a Premier Support request with Microsoft. The answer we received was that the PrimarySmtpAddress attribute can only be updated by an account with the Global Administrator role. More restrictive roles such as User Management Administrator or Exchange Administrator are not sufficient. We did verify that our folks with the Global Admin role can indeed successfully run the commands which fail for other individuals.

 

So the solution - for now, anyway - is to have someone in the Global Admin role update the primary SMTP address when needed.

Even though I logged in as a global administrator, I received the same error. It has been working fine but suddenly it didn't work.

 

# Info

  • Date: 2018-06-01 to 2018-06-02
  • Command: Set-UnifiedGroup -Identity "old@mydomain.com" -PrimarySmtpAddress "new@mydomain.com"
  • Error Message:
    We failed to update the unified group. Please try again later.+ CategoryInfo : NotSpecified: (:) [Set-UnifiedGroup], TaskException+ FullyQualifiedErrorId : [Server=HK0PR03MB3522,RequestId=66c8baa3-35be-40d9-8661-5db74747fa11,TimeStamp=6/2/2018 5:17:01 AM] [FailureCategory=Cmdlet-TaskException] 67671B94,Microsoft.Exchange.Management.RecipientTasks.SetUnifiedGroup+ PSComputerName : outlook.office365.com
  • Version (16.0.0.0)
    - Name: Microsoft.Exchange.Management.ExoPowershellModule

 

# My Test

  • Period: 2018-06-01 to 2018-06-02
  • Console: PowerShell ISE, Visual Studio Code - PowerShell Integrated Console
  • Tested with two users
    • A global administrator
    • My account : changed my account role to a global administrator

 

Hi MOONSO KO

We are currently experiencing a temporary outage in this service. The cmdlet should be working again soon.

Hi MOONSO KO,

You can try the following cmdlet to update the primary SMTP address of the O365 group.

Set-UnifiedGroup -Identity old@mydomain.com -EmailAddress @{remove=”SMTP:old@mydomain.com”;add=”SMTP:new@mydomain.com”,”smtp:old@mydomain.com”}

This should update the primary SMTP address to the new@mydomain.com and set the old@mydomain.com to a secondary SMTP address.

Hi Jason,

 

I'm in the same position as Moonso Ko. In my case, attempting your workaround did alter the email addresses, but not the primary SMTP address for the group, and returned the error;

 

There is no primary SMTP address.
+ CategoryInfo : NotSpecified: (XXXXXXXX:ADObjectId) [Set-UnifiedGroup], DataValidationExcept
ion
+ FullyQualifiedErrorId : [Server=XXXXXX,RequestId=e54f49cd-6dd5-4309-9c96-a415efc1ced5,TimeStamp=6/5/2018
8:17:00 PM] [FailureCategory=Cmdlet-DataValidationException] 4FC61324,Microsoft.Exchange.Management.RecipientTasks
.SetUnifiedGroup
+ PSComputerName : outlook.office365.com

 

HTH,

 

Rob


@Jason Paul Viola wrote:

You can try the following cmdlet to update the primary SMTP address of the O365 group.

@Set-UnifiedGroup -Identity old@mydomain.com -EmailAddress @{remove=”SMTP:old@mydomain.com”;add=”SMTP:new@mydomain.com”,”smtp:old@mydomain.com”}
.
I've just been trying this with Global Admin account and still getting "We failed to update the unified group. Please try again later."

Incredibly frustrating.


@Mohammad Sarosh wrote:

Hi MOONSO KO

We are currently experiencing a temporary outage in this service. The cmdlet should be working again soon.


Can you provide a bit more information about when the cmdlet should be working? We REALLY need to change the email address of one of our Office 365 Groups, as soon as possible.

 

Is this outage something that will show in Service Health in the O365 Admin Center?

 

Thanks,

Jim

 Hi Jason,

 

Thank you for your update. I tried your script but it didn't work.

 

# Error Message

There is no primary SMTP address.
    + CategoryInfo          : NotSpecified: (Old:ADObjectId) [Set-UnifiedGroup], DataValidationException
    + FullyQualifiedErrorId : [Server=XXXXXX,RequestId=c0385b6c-f9d6-45af-8c1d-b3ec9d1aab74,TimeStamp=6/6/2018 2:24:31 AM] [FailureCategory=Cmdlet-DataValidationExcept
   ion] 4F3E44A4,Microsoft.Exchange.Management.RecipientTasks.SetUnifiedGroup
    + PSComputerName        : outlook.office365.com

I opened a ticket for this and a MS engineer tested some and now he is looking into the transcript. 

 

 

# MS Diagnose

  • Start-Transcript
  • Add new email and test address: OK
    • Set-UnifiedGroup -Identity "Old Group" -EmailAddresses: @{Add ="new@abc.com"}
    • Set-UnifiedGroup -Identity "Old Group" -EmailAddresses: @{Add ="test@abc.com"}
  • Remove old email address: Error 
    • Set-UnifiedGroup -Identity "Old Group" -EmailAddresses: @{Remove="old@abc.com"}
    • Error: There is no primary SMTP address
  • Set SMTP email address (new, test): Error
    • Set-UnifiedGroup -Identity "Old Group" -EmailAddress SMTP:"new@abc.com"
    • Error: We failed to update the unified group. Please try again later
  • Set primary smtp address by using a pipe (new, test)
    • Get-UnifiedGroup -identity "Old Group" | Set-UnifiedGroup -PrimarySmtpAddress new@abc.com
    • Error: We failed to update the unified group. Please try again later
  • Collect the exception message
    Microsoft.Exchange.Configuration.Tasks.TaskException: We failed to update the unified group. Please try again later. at Microsoft.Exchange.Configuration.Tasks.Task.ThrowError(Exception exception, ErrorCategory errorCategory, Object target, String helpUrl) at Microsoft.Exchange.Configuration.Tasks.Task.WriteError(Exception exception, ErrorCategory category, Object target, Boolean reThrow) at Microsoft.Exchange.Configuration.Tasks.Task.WriteError(LocalizedException exception,                   ExchangeErrorCategory category, Object target) 
    ...
  • Stop-Transcript

Hi Jim

We will start rolling out the fix tomorrow on 7th June so you should see it any time by the end of this week.

@Mohammad Sarosh can you please get the message about this fix out to the support organization? Apparently, some engineer advised a user that "Microsoft had removed the functionality to change the primary SMTP address of an Office365 Groups (Unified Group)"

 

https://social.technet.microsoft.com/Forums/msonline/en-US/d238a421-6db6-441a-ae43-496f5b78a1af/unab...

Using Set-Group seems to do the trick:

 

 Set-Group "GroupName" -WindowsEmailAddress "NewPrimaryEmail@domain.com"

Worked for me too

@Vasil - let me know if you have specifics as in ticket numbers where support gives such an explanation. I already posted on that thread also. Thank you!

I tested updating a group's primary domain with Set-Group and, while it did update the primary email in exchange, it still shows with the old domain in lists. Using Get-MsolGroup, I can see that not all of the properties were updated on the AzureAD side of things. I'm hoping they will fix the problem with set-unifiedgroup soon, as I have a bunch of groups that were supposed to be transition to a new domain on Monday!