Cannot provision SP modern site with Group programmatically - "Alias is already in use"

Copper Contributor

Hi,

 

I'm building a solution that can provision O365 Groups with associated Modern Team Site and Teams.

While trying to create some new Sites with Groups, sometimes the creation fails with the error message "The alias for the group already exists".

 

Provisioning :

Tried both using New-PnPSite from PnP PowerShell v2.28.1807.0 , as calling directly the REST API /_api/GroupSiteManager/CreateGroupEx

with the same result (error)

 

Payload:

{"displayName":"TestPosh2",

"alias":"13015",

"isPublic":false,

"optionalParams":{"Description":"","CreationOptions":{"results":[],"Classification":""}}}

 

Response:

{"error":{"code":"-2147024713, Microsoft.SharePoint.SPException","message":{"lang":"nl-NL","value":"De alias voor de groep bestaat al."}}}

 

There isn't any visible existing Alias created in the tenant with that ID.

To verify this I did check

- Exchange Admin Center

- Get-UnifiedGroup (Exchange)

- Get-PnPUnifiedGroup

- /_api/GroupSiteManager/GetValidSiteUrlFromAlias?alias='13015'

 

They all return no matching data, the last one returns an OK status code with the available URL for site:

http://tenant.sharepoint.com/sites/13015

 

How can I further see whether this alias can be in use, or successfully use it for the new site?

4 Replies

Hi Massimo,

 

Could it be a site with the same URL / alias still exists in the Site Collection recycle bin? Does this error occur randomly for you or are you frequently deleting  / recreating your modern SP sites with the same name / alias?

Hi Paul,

 

it could very well be the case, but I'm not 100% sure.

Being these site collections, I'm looking at the Recycle Bin from (old) Admin Center, the list of deleted sites from New Preview Admin Center, and Exchange Admin Center.

In the last one, in my experience, a full historical list of groups provisioned is maintained: I don't see any item with assigned alias '13015' there, and for other groups that have been deleted I can correctly re-assign that alias. So I'd say it happens randomly.

 

I don't think there're other places then to look and find for match.

Thanks for your answer, and thinking together.

 

Cheers

Massimo

I'm seeing the same issue in a customer tenant, no modern sites w/ groups are able to be created. In fact, we're not able to do so using any of the following approaches:

  1. Programmatically via Azure Function
  2. Using PNP PowerShell (New-PnPSite)
  3. Using the modern administration portal Create Site link

We're now using this approach: 

Interact with Graph and make O365 Groups with AzureFunctions PowerShell

so using an AAD app identity with delegated permissions, and calling into MS Graph.

 

It is in general more reliable than other approaches you mentioned, and we've tried as well. Especially in regards with the associated SP modern site, which gets provisioned in a timely fashion consistently with this approach

 

Hope it helps