In this article, I am going to explain how to add remove bulk users to Microsoft Teams team or Microsoft 365 group using Office 365 CLI and PowerShell Script.
What is Office 365 CLI?
Office 365 CLI is an open-source project driven by the SharePoint Patterns and Practices initiative. The project is built and managed publicly on GitHub and accepts community contributions.
How can contribute to Office 365 CLI open-source project?
Office 365 CLI open-source project has a number of feature requests that are a good starting point to contribute to the project.
Why should I contribute to Office 365 CLI?
You may have different individual motivations but working on @office365cli improves coding skills, gain early experience, recognition and chance to work with top class developers around the globe.
How to install the Office 365 CLI?
Office 365 CLI is distributed as a Node.js package and published on npmjs.com. You can install it using your Node package manager, such as npm or Yarn.
To install the Office 365 CLI, in the command line execute:
npm install -g @pnp/office365-cli
What are all the commands used from Office 365 CLI in this sample code?
- Lists Office 365 Groups in the current tenant
- Gets information about the specified user
- Adds user to specified Office 365 Group or Microsoft Teams team
- Removes the specified user from specified Office 365 Group or Microsoft Teams team
Companies pursue to hasten profits growth or enter new marketplace through Mergers and Acquisitions(M&A). M&A typically fails during integration. This also applies to migrating users and data in Microsoft Teams and Groups. Partial acquisition can be pretty tricky. To help make the activity as charming as possible, I have created the following sample script to add/remove bulk users to/from Microsoft Teams team or Microsoft 365 group using Office 365 CLI commands.
Note: Refactor the code as per your requirement.
Input CSV File Format
I hope you find this post helpful. Let me know your thoughts in the comments section.
Photo by Manasa Muthyala