Office 365 – Naming convention for Office 365 Groups is available in preview

We already had a group naming policy available for Exchange security mail-enabled or distribution groups BUT this did not apply to Office 365 Group name.

Starting today, and in preview, a group naming policy is available for Office 365 Groups; this will apply to Office 365 Groups AND Teams

NOTE this functionality requires to have Azure AD Premium and the Azure AD Preview module (version or later)

To implement Office 365 Groups naming policy, you need to connect to your Azure AD with PowerShell and the use the following commands

  • To install the Azure AD Preview module, run the following command Install-Module AzureADPreview from a PowerShell prompt launched with the run as administrator

As usual with the Install-Module command, you  may be prompted to install NuGet and trust the repository

NOTE you may need to uninstall previous version of the Azure AD modules or Azure AD Preview modules prior to install the latest version


  • Once installed, connect to your Azure AD Tenant with the command Connect-AzureAD


Get Current Office 365 Groups Naming Settings

  • To get the existing naming convention settings, run the commands $Setting = Get-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id and then $Setting.Values


Define Office 365 Groups Prefixes/Suffixes

  • To define names prefixes and/or suffixes run the following commands $Setting["PrefixSuffixNamingRequirement"] = <your prefix / suffix settings>, like $Setting["PrefixSuffixNamingRequirement"] = “Grp_[Department]_[GroupName]_[Country]", and then Set-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id -DirectorySetting $Setting

NOTE you can use either a string and/or user attribute between brackets []. Using user attributes will automatically fill the ‘gap’ with the value from your Azure AD (or your Active Directory if you are using directory sync). The [GroupName] section will be filled with the value provided by end-user during the group creation


Define Office 365 Groups Block Words

  • To define a list of blocked words, use the commands$Setting["CustomBlockedWordsList"]=”<your blocked word comma separated list>”, like $Setting["CustomBlockedWordsList"]=”Payroll,CEO,HR”, and then Set-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id -DirectorySetting $Setting

Disable the setting

  • If you want to disable one of these settings, just set the value to $null, like $Setting["PrefixSuffixNamingRequirement"] = $null and run the set command Set-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id -DirectorySetting $Setting


End-User Experience

The policy will then be applied and available from any client used to create new Office 365 Groups (or Teams), like Outlook on the Web (OWA), Outlook 2013/2016 on Windows or Outlook for Mac.

NOTE this seems not applicable if an Office 365 administrator is creating the group from Office 365 Admin portal or Azure Portal