First of all let me tell you that you must save any .csv input files in UTF-8 format. This will allow your language spesific letters to display correct, for example the letters æ,ø,å are spesific to Norwegian. So use Notepad ++ to Encode to UTF-8
The first step (since I am an SP dude) is to add SiteGroups and their permission levels. Also you can create Custom permission levels. To create your own permission level I prefer to use GUI -notice that I have created a Custom permission level with read on items and versions, and the possibillity to manage personal views.
Next step is to add SiteGroups and their PermissionLevels, to do this I use a comma separeted file, and import this with PowerShell to the sitecollection.
PS Script:
PS>Import-Csv C:\admin\SMGroupsAndPermissions.csv | ForEach-Object {New-SPOSiteGroup -Site $_.Site -Group $_.Group -PermissionLevels $_.PermissionLevels }
My CSV file in Notepad ++ looks like this:
-first line is the references to PowerShell –scope, the permission level must exist (and offcourse url to site), groups will be created.
Here’s the outpout from PS ISE:
Notice that some of my Groups allready existed, and you get a red PS Error –that’s no problem, the new ones will be created.
Wanna remove a group, use this PS:
PS>Remove-SPOSiteGroup -Site https://vaerpn.sharepoint.com/sites/github -Identity "Administration Visitors"
Useful References:
Set up the SharePoint Online Management Shell Windows PowerShell environment
Use Windows Powershell cmdlets to manage groups in SharePoint Online site collections