This project contains tools for managing Microsoft 365 environments using Microsoft Graph API. These tools help administrators automate common tasks such as user management, exporting user details, and cleaning up deleted user objects.
- User Management: Retrieve, create, and delete users within your Microsoft 365 environment.
- Export to CSV: Export user details to a CSV file for reporting and analysis.
- Cleanup Deleted User Objects: Automatically remove deleted user objects to keep your environment clean and organized.
- PowerShell 7.x
- Microsoft 365 account with appropriate permissions to use Microsoft Graph API
-
Change directory to the $HOME
cd $HOME
-
Clone the repository:
git clone https://github.com/yourusername/M365AdminTools
-
Navigate to the project directory:
cd M365AdminTools -
Add $HOME\M365AdminTools\scripts to the $PATH:
./setup.ps1
-
Copy the sample credentials file and rename it:
cd scripts cp credentials.json.sample credentials.json -
Edit the
credentials.jsonfile and enter your Tenant Id, Client Id, and Client Secret:{ "tenantId": "your-tenant-id", "clientId": "your-client-id", "clientSecret": "your-client-secret" }
-
To retrieve Microsoft 365 license information
./get-m365-license.ps1
-
To retrieve users:
./get-m365-users.ps1 [-Outputfile <outputsile>]
-
To create a user:
./add-m365-users.ps1 -Inputfile <Inputfile> [-Outputfile <outputsile>]
-
To delete a user:
./remove-m365-users.ps1 -Inputfile <Inputfile> [-Outputfile <outputsile>]
-
To clean up deleted user objects:
./cleanup-m365-deleted-users.ps1
-
To create a Temporary Access Pass:
./create-tap.ps1 -Inputfile <Inputfile> [-Outputfile <outputsile>]
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.