Make office365 security group or Microsoft Teams group from CSV

%3CLINGO-SUB%20id%3D%22lingo-sub-1249127%22%20slang%3D%22en-US%22%3EMake%20office365%20security%20group%20or%20Microsoft%20Teams%20group%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1249127%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20a%20possible%20way%20to%20make%20a%20office365%20security%20group%20or%20a%20Microsoft%20Teams%20group%20from%20a%20CSV%20file%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKind%20Regards%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EZenna%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1249127%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%20Groups%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1250075%22%20slang%3D%22en-US%22%3ERe%3A%20Make%20office365%20security%20group%20or%20Microsoft%20Teams%20group%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1250075%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20that's%20one%20of%20the%20main%20reasons%20we%20use%20PowerShell%20for.%20There%20are%20plenty%20examples%20available%20online%20and%20here%20on%20the%20forums%2C%20look%20them%20up.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1254253%22%20slang%3D%22en-US%22%3ERe%3A%20Make%20office365%20security%20group%20or%20Microsoft%20Teams%20group%20from%20CSV%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1254253%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F592480%22%20target%3D%22_blank%22%3E%40zenna%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%26nbsp%3B%3Ca%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F592480%22%3E%40zenna%3C%2Fa%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3ECreate%20a%20CSV%20file%20with%20one%20column%20as%20shown%20in%20the%20Screenshot%20below.%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22zenna.PNG%22%20style%3D%22width%3A%20339px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F179542i898C982959D5E5FB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22zenna.PNG%22%20alt%3D%22zenna.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3ELabel%20the%20header%20of%20the%20CSV%20file%20as%20'users'%3C%2FLI%3E%3CLI%3EPopulate%20the%20column%20with%20the%20email%20address%20of%20the%20users%20to%20Add%20to%20the%20DL%3C%2FLI%3E%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fexchange%2Fexchange-online%2Fconnect-to-exchange-online-powershell%2Fconnect-to-exchange-online-powershell%3Fview%3Dexchange-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EConnect%20to%20Exchange%20Online%20PowerShell%3C%2FA%3E%3C%2FLI%3E%3CLI%3Erun%20the%20following%20one%20liner%20code%3C%2FLI%3E%3C%2FUL%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3Eimport-csv%20-Path%20%22C%3A%5CUsers%5Cuser%5CDesktop%5Cbook1.csv%22%20%7C%20ForEach-Object%20%7B%20Add-UnifiedGroupLinks%20-Identity%20%22%3CNAMEOFO365GROUP%3E%22%20-LinkType%20%22members%22%20-Links%20%24_.users%20%7D%3C%2FNAMEOFO365GROUP%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E*replace%20-Path%20with%20the%20path%20of%20the%20CSV%20file%20you%20created%20and%20%3CNAMEOFO365GROUP%3E%20with%20the%20name%20of%20the%20Group%20(remove%20the%20angle%20brackets).%3C%2FNAMEOFO365GROUP%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20should%20work%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi all,

 

Is there a possible way to make a office365 security group or a Microsoft Teams group from a CSV file?

 

 

Kind Regards,

 

Zenna

2 Replies
Highlighted

Yes, that's one of the main reasons we use PowerShell for. There are plenty examples available online and here on the forums, look them up.

Highlighted

@zenna 

 

Hi @zenna

 

  • Create a CSV file with one column as shown in the Screenshot below.

zenna.PNG

import-csv -Path "C:\Users\user\Desktop\book1.csv" | ForEach-Object { Add-UnifiedGroupLinks -Identity "<nameofO365group>" -LinkType "members" -Links $_.users }

*replace -Path with the path of the CSV file you created and <nameofO365group> with the name of the Group (remove the angle brackets).

 

This should work