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:
To get full details of this unified group, I ran below command:
Get-AzureADMSGroup -SearchString Sri | fl
Response:
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:
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:
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
Click on this option to edit Primary email address like below:
You can change Primary email address value and select Done
like below:
You can delete the existing Alias if you don't need them like below:
When I fetch the full details of that group again from PowerShell, I got the results successfully with new Mail
like below:
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