Okay – another simple one. When you’re creating a new Office Group (or “Unified Group”, like they’re called as well), you might get an error for the alias already being used. Pretty simple, but still – let’s see how to fix it.
So, this error pops up, while you’re trying to create a new Office Group:
The alias is being used by another group in your organization. Please try a different alias.
An example script & output is shown below:
# Historically, Groups have been managed through Exchange, and that's why you need to initialize an Exchange remote management session (instead of something like SharePoint Management commandlets) $creds = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $creds -Authentication Basic -AllowRedirection Import-PSSession $Session new-unifiedgroup -DisplayName "Marketing" -Alias "Marketing" The alias is being used by another group in your organization. Please try a different alias. + CategoryInfo : NotSpecified: (:) [New-UnifiedGroup], TaskException + FullyQualifiedErrorId : [Server=HE1P190MB0426,RequestId=17407434-2fb1-4336-aa65-4eab8a1badac,TimeStamp=...] [FailureCategory=Cmdlet-TaskException] 5BD74DA7,Microsoft.Exchange.Management.RecipientTasks.NewUnified Group + PSComputerName : outlook.office365.com
To see if the alias is really in use, you can run this – and optionally also remove the Group (please don’t do this if the Group is actually in use!):
Get-UnifiedGroup Name DisplayName GroupType PrimarySmtpAddress ---- ----------- --------- ------------------ Marketing_547ca985-d635-4a52-9d28-2b45dac14677 Marketing Universal Marketing@contoso.onmicrosoft.com Remove-UnifiedGroup -Identity "Marketing"
But.. Even after removing the Group, you probably still get the error. What on Earth do you need to do to get that damn Group to be provisioned??
A quick reality check: this article describes a situation where you apparently don’t have a group with the alias you want to use, but get an error anyway. However, if you have a group with the said alias already, and want to rename it, see this thread for ideas: https://community.spiceworks.com/topic/2157678-unable-to-remove-office365-group-alias
Back to the topic!
In this case, you probably just have a pre-existing group with the same alias, but the group was already removed. However, it’s only soft deleted.
See – Office Groups are not removed right away. Since there’s a bunch of different resources associated with a group, Microsoft was probably foreseeing a lot of cases where someone brazenly removes a Group that still had plenty of users at least for some of its tools and features! All of the assets are conserved for another 30 days after the removal, and during this time, the URLs are also still reserved for the soft-deleted assets!
In short, you’ll need to get rid of the soft-deleted Group before you can reuse the alias for a new Group. A simple PowerShell commandlet for this purpose exists, and running that is what you need to do.
Even though we initiated an Exchange remote session earlier to provision (or remove, for that matter) a group, to finalize the deletion we actually need to use AzureAD commandlets (SharePoint Online Management commandlets) instead!
See below for an example on how to identify the Groups that have been soft-deleted but still have reserved their URLs:
# Weirdly enough, to delete a soft-deleted group, you'll need to user AzureAD commandlets instead of the Exchange commandlets. # This requires another authentication as well. Import-Module AzureAD connect-azuread -Credential $creds # First Get-AzureADMSDeletedGroup
And below, and example how to figure out the “Identity” (actually, “DisplayName”) of the Group and then get rid of it!
# First, let's find out the "Identity" (which actually matches the DisplayName, not Id) Get-AzureADMSDeletedGroup Id DisplayName Description -- ----------- ----------- ef8bffa8-4813-4505-96c0-7dbc18ce387d Marketing Remove-UnifiedGroup -Identity "Marketing"
And you should be good!
Alternatively, if you just want to get rid of all of the removed Groups (please consider before running this in production!), run this:
# Gets and removes all of the soft-deleted Groups Get-AzureADMSDeletedGroup -All:$true | Remove-AzureADMSDeletedDirectoryObject
Note: the commandlets above are from AzureAD module, not EXO, which is the classic way of managing “Unified Groups”.
Caveat – what if you STILL get the error after this?
In this case (like in so many others), the truth is weirder than the documentation, and the actual removal of the Groups and other assets with that PowerShell commandlet might actually take up to 24 hours.
I found a lot of mentions about this online (including the one below) but nothing official. Anyway – both restoring and removing the deleted Groups might sometimes take up to 24 hours.
This issue is very similar to the one described in the posts below – in that case, a site already exists and blocks the creation of another site with the same URL. Just this time, the error is far more descriptive!
He's been a developer from 2004 (starting with PHP and Java), and he's been bending and twisting SharePoint into different shapes since MOSS. Nowadays he's not only working on SharePoint, but also on .NET projects, Azure, Office 365 and a lot of other stuff.
This is his personal professional (e.g. professional, but definitely personal) blog.
Latest posts by Antti K. Koskela (see all)
- Azure DevOps – how to package a simple DLL? - October 17, 2019
- How to use UriHelper or NavigationManager in .NET Core 3.0 & Blazor? - October 17, 2019
- Azure DevOps build fails with “The nuget command failed with exit code(1) and error(Cannot determine the packages folder to restore NuGet packages.” - October 16, 2019