Adding/Removing Users
Adding Users
With 365AutomatedLab, you can add as many users with their primary licensing as you need at one time. Currently, the Microsoft Dev Environment only allows 25 licensed users, and one is your primary account, so the max I’d recommend creating is 24 users if you’ll only be using this in a dev environment.
Quickest way to get started is by opening the 365DataEnvironment Excel Workbook in the LabSources folder. Here you can see the formatting for the cells so that a user can be added. (Let me know if you would like more attributes added, as these are required and ones I felt would be most useful to start)
View of 365DataEnvinronment.xlsx
FirstName | LastName | UserName | Title | Department | StreetAddress | City | State | PostalCode | Country | PhoneNumber | MobilePhone | UsageLocation | License |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Alice | Johnson | ajohnson | IT Specialist | IT | 1818 Maple St | Albany | NY | 12207 | USA | 212-555-1234 | 212-555-5678 | US | DEVELOPERPACK_E5 |
If you want to use “real” data, I’d recommend exporting your users from your production environment that you want to test, which you can use “Export-CT365ProdUserToExcel” to do this if you don’t already have a script to do so. You will have to copy the information into the 365DataEnvironment.xlsx, as the export as of right now is using Microsoft default column headers and I need to change them to match the excel sheets.
Now that you have your data all set, it’s time to add them to your Dev tenant.
New-CT365User -FilePath "C:\\Path\\to\\file.xlsx" -domain "contoso.com"
The file path is exactly what it says and you are required to type out the .xlsx or it will fail. The domain will be the domain for your tenant, if its a dev tenant it should be domainname.onmicrosoft.com. Then it will ask you to type in a password that you will user for all users.
That’s it, now you have created all your users.
Deleting Users
Now say you are done testing with those users and you want to remove them, or something you were testing changed their information too much from their original state? All you need is this line of code, and they will all be removed.
Remove-CT365User -FilePath "C:\\Path\\to\\file.xlsx" -Domain "contoso.com"
After the magic of PowerShell happens, all those users will be gone. Nice and easy, right?
Summary
Hope you found this useful, as it has saved me many times/hours when testing different scripts and changing the source data too much, then having to remember the users information to delete. I was surprised when I hadn’t seen anything like this as I know there are so many people testing in 365, and why not make it easier? Please look out for the next part of this series where you’ll be able to add and remove all the different types of groups in 365.
As always feel free to reach out anytime, and let me know what you think as well! Have a great day!