Group naming policy enabled tenant - Not allowing to create 'Teams' through provisioned jobs

%3CLINGO-SUB%20id%3D%22lingo-sub-2005651%22%20slang%3D%22en-US%22%3EGroup%20naming%20policy%20enabled%20tenant%20unable%20to%20allow%20create%20'Teams'%20through%20provisioned%20jobs%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2005651%22%20slang%3D%22en-US%22%3E%3CPRE%3EHello%20All%2C%3CBR%20%2F%3E%3CBR%20%2F%3EActually%20We%20have%20enabled%20'Group%20Naming%20policy'%20on%20our%20O365%20tenant%20like%20below%3A%3CBR%20%2F%3E%3CSTRONG%3ECurrent%20Policy%3A%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CGROUP%20name%3D%22%22%3E(%3CCOMPANY%3E)%20%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20works%20perfectly%20fine%20when%20we%20create%20Teams%20through%20Teams%20App%20but%20we%20are%20facing%20below%20error%3CBR%20%2F%3Ewhen%20we%20try%20to%20create%20through%20provisioning%20CSOM%20based%20console%20job.%20To%20fit%20in%20naming%20policy%20we%3CBR%20%2F%3Efetching%20user%20company%20name%20and%20appending%20suffix%20to%20Group%20name.%20%3CSTRONG%3EEx.%20TestTeam(CompanyName)%3C%2FSTRONG%3E%3C%2FCOMPANY%3E%3C%2FGROUP%3E%3C%2FPRE%3E%3CPRE%3ECode%3A%20Request_BadRequest%0AMessage%3A%20The%20property%20is%20missing%20a%20required%20prefix%2Fsuffix%20per%20your%20organization's%20Group%20naming%20requirements.%0ADetails%3A%0A%20Detail0%3A%0A%20%20Code%3A%20MissingPrefixSuffix%0A%20%20Target%3A%20displayName%0A%20%20AdditionalData%3A%0A%20suggestedPropertyValue%20%3A%20sid-12-18-2021(MyCompany)()%3C%2FPRE%3E%3CPRE%3E%26nbsp%3BBelow%20code%20we%20are%20referring%3A%3CBR%20%2F%3EUnifiedGroupEntity%20unifiedGroupEntity%20%3D%20UnifiedGroupsUtility.CreateUnifiedGroup(%3CBR%20%2F%3EunifiedGroupInformation.DisplayName%2C%20unifiedGroupInformation.Description%2C%3CBR%20%2F%3EunifiedGroupInformation.MailNickname%2C%20accessToken%2C%20unifiedGroupInformation.Owners%2Cnull%2C%20%3CBR%20%2F%3Etrue%2C%20true%2C%2010%2C%20500)%3B%3CBR%20%2F%3E%3CBR%20%2F%3EPlease%20let%20me%20know%20where%20the%20things%20getting%20wrong.%3CBR%20%2F%3EBR%2F%20Sid%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2005651%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2008624%22%20slang%3D%22en-US%22%3ERe%3A%20Group%20naming%20policy%20enabled%20tenant%20-%20Not%20allowing%20to%20create%20'Teams'%20through%20provisioned%20jobs%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2008624%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F259106%22%20target%3D%22_blank%22%3E%40SiddheshwarKohale%3C%2FA%3E%26nbsp%3B%2C%20There%20are%20some%20strict%20guidelines%20that%20are%20to%20be%20followed%20when%20creating%20a%20group%20policy%20in%20azure%20active%20directory%20that%20enforces%20consistent%20naming%20conventions%20for%26nbsp%3B%3CSPAN%3E%26nbsp%3BMicrosoft%20365%20groups%20created%20or%20edited%20by%20your%20users%2C%20set%20up%20a%20group%20naming%20policy%20for%20your%20organizations%20in%20Azure%20Active%20Directory%20(Azure%20AD).%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI%20would%20suggest%20you%20to%20refer%20to%20your%20naming%20policies%20in%20your%20AAD%20and%20use%20the%20same%20to%20create%20a%20group%20using%20console%20job.%20As%20from%20your%20error%20it's%20clear%20that%20there%20is%20some%20format%20error%20in%20prefix%20and%20suffix.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPlease%20follow%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fenterprise-users%2Fgroups-naming-policy%23configure-naming-policy-in-azure-portal%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3Ethis%3C%2FA%3E%20article%20for%20more%20details.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2053030%22%20slang%3D%22en-US%22%3ERe%3A%20Group%20naming%20policy%20enabled%20tenant%20-%20Not%20allowing%20to%20create%20'Teams'%20through%20provisioned%20jobs%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2053030%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F259106%22%20target%3D%22_blank%22%3E%40SiddheshwarKohale%3C%2FA%3E%26nbsp%3B%20%3A%20We%20are%20looking%20into%20this%20issue%2C%20and%20will%20update%20you%20once%20I%20receive%20any%20update%20from%20internal%20developers%20team.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2070456%22%20slang%3D%22en-US%22%3ERe%3A%20Group%20naming%20policy%20enabled%20tenant%20-%20Not%20allowing%20to%20create%20'Teams'%20through%20provisioned%20jobs%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2070456%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F259106%22%20target%3D%22_blank%22%3E%40SiddheshwarKohale%3C%2FA%3E%26nbsp%3B%3A%20Hi%20Sid%2C%20can%20we%20discuss%20this%20over%20a%20call%3F%20Please%20write%20to%20us%20microsoftteamsdev%40microsoft.com%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor
Hello All,

Actually We have enabled 'Group Naming policy' on our O365 tenant like below:
Current Policy:
<Group name>(<Company>)

It works perfectly fine when we create Teams through Teams App but we are facing below error
when we try to create through CSOM based (c#) provisioning console job. To fit in naming policy we
are fetching user's company name and appending suffix to Group name. Ex. TestTeam(CompanyName)
Error Message:
Code: Request_BadRequest Message: The property is missing a required prefix/suffix per your organization's Group naming requirements. Details: Detail0: Code: MissingPrefixSuffix Target: displayName AdditionalData: suggestedPropertyValue : sid-12-18-2021(MyCompany)()
Below source code we are referring to create Teams:
UnifiedGroupEntity unifiedGroupEntity = UnifiedGroupsUtility.CreateUnifiedGroup(
unifiedGroupInformation.DisplayName, unifiedGroupInformation.Description,
unifiedGroupInformation.MailNickname, accessToken, unifiedGroupInformation.Owners,null,
true, true, 10, 500);

Please let me know where the things getting wrong.
BR/ Sid
8 Replies

@SiddheshwarKohale , There are some strict guidelines that are to be followed when creating a group policy in azure active directory that enforces consistent naming conventions for  Microsoft 365 groups created or edited by your users, set up a group naming policy for your organizations in Azure Active Directory (Azure AD). 

 

I would suggest you to refer to your naming policies in your AAD and use the same to create a group using console job. As from your error it's clear that there is some format error in prefix and suffix. 

 

Please follow this article for more details.

 

Also check if the data is already filled in object in code before creating a team

@Manish-MSFT  - We are already using C# based console job to create Teams.  Below are few more details:

Azure AD Group Policy:

Policy.png

Error Message:

ErrorMessage-2.png

Stack Trace:

ErrorMessage-1.png

UnifiedGroupInformation Payload is like this before creating Teams:

Payload.png

Code snippet:

code snippet.png

 

Still we are facing similar issue. Please suggest possible solutions if any.

 

Thanks.

BR. Sid

@SiddheshwarKohale  : We are looking into this issue, and will update you once I receive any update from internal developers team.

Hello Manish,

Thanks for taking this issue in your priority list. We are waiting for your reply on this.

Thanks.
BR. Sid

@SiddheshwarKohale : Hi Sid, can we discuss this over a call? Please write to us microsoftteamsdev@microsoft.com

@Manish-MSFT - Sure, We can discuss this case over a call. Thanks for consideration. We have sent email to 'microsoftteamsdev@microsoft.com' and provided necessary details.

@SiddheshwarKohale , As discussed over the call, please forward us the required steps for repro. The steps must be clear such that we can repro and file a bug.