What
Renaming an Office 365 Group is simple if all you want to change is its display name. However, if you want to free up the email address it used (in our case, Office 365 Groups are neat and all, but the mailbox functionality is extremely limited – you can’t move messages, archive them, categorize them … truly almost completely useless).
So What
Again, renaming the Group is easy in the Admin Web Pages of Office 365. But if you need to rename the email address/alias it uses, you’ll need some PowerShell and hit up:
- The Primary Address (primarySMTPAddress)
- The Email Aliases it uses (emailaddresses)
Now What
I’m not going to go into all the detail of how to connect and authenticate to Exchange Online as there is lots of stuff out there, I’m just going to point out what you’ll want to be changing and checking…
To Check Where The Email Alias (Proxy) is right now…
Let’s assume for this exercise that [email protected] was pointed to an Outlook Group and you decided that using a group wasn’t a fit (such as the example above) and instead that you wanted to reclaim that alias for a Shared Mailbox (in our case, we couldn’t just delete the old group as it had stuff we wanted to keep in it).
Get-Recipient | where {$_.EmailAddresses -match “[email protected]”} | fL Name, RecipientType,emailaddresses
To Change the Group (called “Our Beers”) Primary Address to “[email protected]”
Set-UnifiedGroup -Identity “Our Beers” -PrimarySmtpAddress “[email protected]”
To Change the Group (called “Our Beers”) Alias to “[email protected]”
Set-UnifiedGroup -Identity “Our Beers” -alias “[email protected]”
To Remove “[email protected]” from the Group as a proxy/alias
set-unifiedgroup “Our Beers” -emailaddresses @{remove=”[email protected]”}
What about changing the domain names for ALL of the groups at the same time?
$AllMailboxes = Get-UnifiedGroup -ResultSize Unlimited
Foreach ($Mailbox in $AllMailboxes)
{
$NewAddress = $Mailbox.Alias + “@domain.com”
Set-UnifiedGroup -Identity $Mailbox.Alias -EmailAddress $NewAddress
Using this this script change all office 365 Group Primary SMTP address but permanently delete all alias address for all Office 365 Group.
The proxy address still exists in at least one more place and it appears Microsoft does not provide a way to delete it. If you use the Azure AD v2 PowerShell module, run Get-AzureAdGroup to see the list of groups. Then run the cmdlet again with the -ObjectID for the specific group and pipe to “fl proxyaddresses”. The alias will still be listed.
The Set-AzureAdGroup cmdlet does not allow modifying ProxyAddresses and so far Microsoft has not figured out a way to delete the address.
We are trying to remove a vanity domain from the tenant that has Power BI so we can add it to a new tenant. We are not willing to delete the O365 Groups as they may adversely affect the Power BI workspaces and reporting. We can’t delete the domain from the tenant until we remove the aliases from the O365 Groups.
Hi Matthew,
Exact same situation here. Were you able to progress this ? We have 43 Office 365 groups in our tenant and we wish to remove the accepted domain but removal is blocking as the domain is still associated with the groups in question.
I see the same thing. I can use Set-UnifiedGroup to set the PrimarySmtpAddress and the EmailAddresses. And this does seem to affect what email addresses email can be delivered to. However, when a O365 Group is created, it also creates a MsolGroup, and if you run a Get-MsolGroup for the group, you will see that the ProxyAddresses attribute was not affected at all, and still has the same 2 addresses listed, and these are the 2 addresses that are still listed in the UI as well. I find no way to change them, and it still means you cannot set (or sync from AD) any other MsolUser or MsolGroup with that address in their ProxyAddresses attribute without a conflict. Come on Microsoft, get your act together. These O365 Groups are still buggy and hard to control. I might be able to delete and re-add the group to free up the email address, but that loses all current email/files/etc. in the O365 group!
Hi All,
I have found a way around this. Change all primary SMTP addresses of the Office 365 groups to primary domain or the domain you don’t want delete. Delete all the office 365 groups that contain the proxy address of the domain you want to remove, delete the domain once all groups have been removed, restore the groups after the domain deletion in office 365. I tested this and all is working.
Import-Module AzureADPreview
Connect-AzureAD
Get-UnifiedGroup -Identity | Remove-UnifiedGroup
To Restore:
Get-AzureADMSDeletedGroup
Restore-AzureADMSDeletedDirectoryObject –Id
If you have a huge list to restore, run
Get-AzureADMSDeletedGroup | Restore-AzureADMSDeletedDirectoryObject
Thank you. This post saved my sanity, trying to change a Group email address in an emergency too late one evening. Much appreciated, MVP.
After creating a group, how much time do you typically have to wait when changing the primarySMTP address for the group?
Thx man!
Really helpfull!