Home > database >  How to change a unified AzureAD group email without using ExchangeOnline?
How to change a unified AzureAD group email without using ExchangeOnline?

Time:12-15

There is a unified Microsoft 365 group in Azure AD that requires a name change. With this change, I would also like to update its email but it does not seem to work. I have tried changing MailNickname but it does not change the email group property either. This is the way I tried doing it in PowerShell.

 Set-AzureADMSGroup -Id $GroupID -DisplayName $NewGroupName -MailNickname $NewGroupName.replace(' ','_')

This MailNickname property change does not produce new aliases either.

Searching online for the answer, it seems people try to use the ExchangeOnline command "Set-UnifiedGroup" which I'd like to avoid, and use mostly AzureAD module-related commands.

Do you know whether this would be possible?

Also, why does changing MailNickname not change anything but that exact property?

CodePudding user response:

I tried to reproduce the same in my environment and got below results

I created one unified Microsoft 365 group in Azure AD with below commands:

Connect-AzureAD
New-AzureADMSGroup -Description “Unified Group” -DisplayName “Sri Unified Group” -MailEnabled $true -SecurityEnabled $true -MailNickname “SriGroup” -GroupTypes “Unified”

Response:

enter image description here

To get full details of this unified group, I ran below command:

 Get-AzureADMSGroup -SearchString Sri | fl

Response:

enter image description here

To change the group name and its email, I ran the same command as you like below:

$GroupID = (Get-AzureADMSGroup -SearchString Sri).Id
$NewGroupName = "Devi Unified Group"
Set-AzureADMSGroup -Id $GroupID -DisplayName $NewGroupName -MailNickname $NewGroupName.replace(' ','_')

Response:

enter image description here

When I fetch the full details of this group, only DisplayName and MailNickname changed but Mail is same as below:

 Get-AzureADMSGroup -SearchString Devi | fl

Response:

enter image description here

Alternatively, you can change it via Microsoft 365 Admin Center portal by signing in with Admin account like below:

Go to Microsoft 365 Admin Center -> Teams & groups -> Active teams & groups -> Your group -> Edit Aliases

enter image description here

Click on this option to edit Primary email address like below:

enter image description here

You can change Primary email address value and select Done like below:

enter image description here

You can delete the existing Alias if you don't need them like below:

enter image description here

When I fetch the full details of that group again from PowerShell, I got the results successfully with new Mail like below:

enter image description here

If you want to change group email address from PowerShell, it is possible only with Exchange Online commands not from Azure AD.

Reference:

How to update Azure AD MS Group Mail and ProxyAddresses field using PowerShell by MMNandM

  • Related