SOLVED
Home

Naming policy using AD groups or IF

%3CLINGO-SUB%20id%3D%22lingo-sub-292775%22%20slang%3D%22en-US%22%3ENaming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-292775%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Apologies%20if%20this%20has%20been%20posted%20before.%20Could%20not%20find%20it.%3C%2FP%3E%3CP%3EIs%20it%20possible%20to%20set%20up%20a%20Naming%20policy%20for%20MS%20Teams%20(Or%20groups)%20by%20Sec%20group%20membership%20or%20and%20IF%20statement.%3C%2FP%3E%3CP%3ESo%20for%20example%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20the%20user%20is%20part%20of%20an%20AD%20sec%20group%20called%20Finance%2C%20then%20the%20prefix%20to%20the%20Naming%20policy%20will%20be%20FINANCE_%7Bgroup%20name%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOR..using%20an%20IF%20statement%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIF%20the%20user%20is%20in%20AD%20group%20Finance%2C%20THEN%20set%20the%20prefix%20to%20FIN_%7BGroup%20Name%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3EWasim%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-292775%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-295436%22%20slang%3D%22en-US%22%3ERe%3A%20Naming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-295436%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20let%20staff%20create%20their%20own%20groups%2C%20but%20if%20you%20want%20to%20apply%20a%20naming%20policy%20you%20need%20to%20either%20do%20it%20when%20the%20group%20is%20created%20(which%20is%20what%20the%20Office%20365%20Groups%20policy%20does)%20or%20afterwards%20(which%20is%20what%20you'd%20do%20with%20a%20custom%20policy).%20I%20wouldn't%20expose%20end%20users%20to%20PowerShell%20cmdlets%20either%20-%20but%20I%20would%20consider%20running%20a%20background%20job%20to%20find%20new%20groups%20and%20update%20their%20displayname.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-295370%22%20slang%3D%22en-US%22%3ERe%3A%20Naming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-295370%22%20slang%3D%22en-US%22%3E%3CP%3EAhh%20ok%20thank%20you%20I%20understand%20what%20you%20mean%20now.%3C%2FP%3E%3CP%3EUnfortunately%20we%20want%20to%20let%20our%20staff%20create%20their%20own%20groups%20but%20within%20the%20confines%20of%20our%20naming%20convention%2C%20i.e.%20Prefix%20of%20Site%20based%20on%20AD%20group.%3C%2FP%3E%3CP%3EWith%20the%20PS%20commands%20they%20wouldn't%20be%20able%20to%20do%20that.%20It%20would%20have%20to%20be%20done%20via%20IT%20or%20someone%20who%20A)%20has%20access%20and%20B)%20Knows%20powershell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20anyway%20for%20the%20response%20Tony.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%3C%2FP%3E%3CP%3EWasim%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-295364%22%20slang%3D%22en-US%22%3ERe%3A%20Naming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-295364%22%20slang%3D%22en-US%22%3E%3CP%3EIf%20you%20write%20your%20own%20code%20to%20manage%20naming%20policy%2C%20you%20can%20use%20any%20of%20the%20properties%20held%20in%20Azure%20Active%20Directory%20(or%20somewhere%20else)%20to%20come%20up%20with%20whatever%20names%20you%20want%20to%20give%20to%20Groups.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20key%20thing%20is%20to%20update%20the%20displayname%20for%20each%20group.%20You%20can%20do%20this%20with%20PowerShell%20or%20the%20Graph%20as%20long%20as%20you%20keep%20the%20assigned%20name%20under%2064%20characters.%20For%20example%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESet-UnifiedGroup%20-Identity%20Group1%20-DisplayName%20%22The%20crazy%20group%20name%20that%20I%20have%20just%20generated%22%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-294555%22%20slang%3D%22en-US%22%3ERe%3A%20Naming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-294555%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Tony%3C%2FP%3E%3CP%3EThanks%20for%20the%20reply.%3C%2FP%3E%3CP%3EYou%20said%3A%3C%2FP%3E%3CP%3E%3CSPAN%3EIf%20you%20write%20your%20own%20method%20of%20applying%20display%20names%20to%20groups%2C%20you%20can%20use%20anything%20you%20retrieve%20from%20Azure%20AD.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ECould%20you%20expand%20on%20this%20some%20more.%20I%20tried%20to%20research%20this%20online%20but%20havent%20found%20anything%20other%20than%20using%20the%20supported%20AD%20Fields.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThanks%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-293311%22%20slang%3D%22en-US%22%3ERe%3A%20Naming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-293311%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20naming%20policy%20for%20Office%20365%20Groups%20supports%20a%20limited%20set%20of%20properties%20as%20you%20note.%20If%20you%20write%20your%20own%20method%20of%20applying%20display%20names%20to%20groups%2C%20you%20can%20use%20anything%20you%20retrieve%20from%20Azure%20AD.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-293308%22%20slang%3D%22en-US%22%3ERe%3A%20Naming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-293308%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3EYes%20I%20have%20read%20that%20link%20and%20it%20says%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E%22Supported%20Azure%20Active%20Directory%20(Azure%20AD)%20attributes%20are%20%5BDepartment%5D%2C%20%5BCompany%5D%2C%20%5BOffice%5D%2C%20%5BStateOrProvince%5D%2C%20%5BCountryOrRegion%5D%2C%20%5BTitle%5D%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20was%20just%20wondering%20if%20you%20can%20use%20AD%20groups%20or%20if%20not%20at%20the%20moment%20if%20thats%20on%20the%20roadmap%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EYou%20mentioned%20creating%20your%20own%20naming%20mechanism%20usinng%20powershell.%20Would%20this%20allow%20you%20to%20use%20AD%20groups%20or%20are%20you%20still%20limited%20to%20the%20support%20attributes%20as%20above.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-292934%22%20slang%3D%22en-US%22%3ERe%3A%20Naming%20policy%20using%20AD%20groups%20or%20IF%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-292934%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2Fadmin%2Fcreate-groups%2Fgroups-naming-policy%3Fview%3Do365-worldwide%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2Fadmin%2Fcreate-groups%2Fgroups-naming-policy%3Fview%3Do365-worldwide%3C%2FA%3E%20-%20the%20Office%20365%20Groups%20naming%20policy%20applies%20to%20Teams.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20that's%20not%20flexible%20enough%2C%20you%20can%20build%20your%20own%20naming%20mechanism%20with%20PowerShell.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Wasim Parkar
Occasional Contributor

Hi Apologies if this has been posted before. Could not find it.

Is it possible to set up a Naming policy for MS Teams (Or groups) by Sec group membership or and IF statement.

So for example

 

If the user is part of an AD sec group called Finance, then the prefix to the Naming policy will be FINANCE_{group name}

 

OR..using an IF statement

 

IF the user is in AD group Finance, THEN set the prefix to FIN_{Group Name}

 

Thanks

Wasim

7 Replies

https://docs.microsoft.com/en-us/office365/admin/create-groups/groups-naming-policy?view=o365-worldw... - the Office 365 Groups naming policy applies to Teams.

 

If that's not flexible enough, you can build your own naming mechanism with PowerShell.

Hi

Yes I have read that link and it says:

"Supported Azure Active Directory (Azure AD) attributes are [Department], [Company], [Office], [StateOrProvince], [CountryOrRegion], [Title]"

 

I was just wondering if you can use AD groups or if not at the moment if thats on the roadmap?

 

You mentioned creating your own naming mechanism usinng powershell. Would this allow you to use AD groups or are you still limited to the support attributes as above.

The naming policy for Office 365 Groups supports a limited set of properties as you note. If you write your own method of applying display names to groups, you can use anything you retrieve from Azure AD.

Hi Tony

Thanks for the reply.

You said:

If you write your own method of applying display names to groups, you can use anything you retrieve from Azure AD.

 

Could you expand on this some more. I tried to research this online but havent found anything other than using the supported AD Fields.

 

Thanks

 

Solution

If you write your own code to manage naming policy, you can use any of the properties held in Azure Active Directory (or somewhere else) to come up with whatever names you want to give to Groups.

 

The key thing is to update the displayname for each group. You can do this with PowerShell or the Graph as long as you keep the assigned name under 64 characters. For example:

 

Set-UnifiedGroup -Identity Group1 -DisplayName "The crazy group name that I have just generated"

Ahh ok thank you I understand what you mean now.

Unfortunately we want to let our staff create their own groups but within the confines of our naming convention, i.e. Prefix of Site based on AD group.

With the PS commands they wouldn't be able to do that. It would have to be done via IT or someone who A) has access and B) Knows powershell.

 

Thank you anyway for the response Tony.

 

Regards

Wasim

You can let staff create their own groups, but if you want to apply a naming policy you need to either do it when the group is created (which is what the Office 365 Groups policy does) or afterwards (which is what you'd do with a custom policy). I wouldn't expose end users to PowerShell cmdlets either - but I would consider running a background job to find new groups and update their displayname.

Related Conversations