Adding members to Office 365 Security Group via csv

Make sure you Connected to Exchange Online PowerShell

Connect-MsolService

You can get the object id of the group you are planning to add from Azure Active directory portal



CSV Sample – Double quotes is very important otherwise you may see undesirable additions.

Import-Csv users.csv |ForEach-Object {Add-MsolGroupMember -GroupObjectId 6e5db514-b162-4de4-ab93-3f1944ea4167 -GroupMemberType user -GroupMemberObjectId (Get-MsolUser -UserPrincipalName $_.userprincipalname).ObjectId}

 

About Satheshwaran Manoharan

Satheshwaran Manoharan is an Microsoft Office Server and Services MVP , Publisher of Azure365pro.com. Specialized in Office365 / Microsoft Exchange / Virtualization , Sathesh is an Messaging Expert supporting/Designing/Deploying many medium size businesses to large enterprises when it comes to Corporate messaging and Virtualization Infrastructure

Check Also

az Git Terraform configs to work behind Proxy

Let’s see how to configure proxy for az Git and Terraform behind an authenticated proxy …

Leave a Reply

Your email address will not be published.