
Here i show you how you can create Bulk Office 365 Users using Azure Powershell.
Before you start you need to install 2 Apps:
- Download Microsoft Online Services Sign-In Assistant
- Windows Azure Directory Module for Windows Powershell
Now you need to download my “Office365_create_new_Users.zip” file here. The zip contains 2 Files:
- Users.csv – filled with all your users
- Office365_create_new_Users.ps1 – your Powershell script to connect to your Office365 Server and create all the new users.
Unzip the Files and save the “Users.csv” to C:\Office365\users.csv
Now you can start to fill in your Users to the csv file – the best way to edit your csv file is to start Excel and import the Data into a new sheet.
Start Excel and head to Data and press Import from Text.
On the second Form tick Tabstopp and Komma. Thats it, now you have a nice formated Excel sheet you can edit.
After you filled your sheet you save it as users.csv to C:\Office365\users.csv
- Right click the Office365_create_new_Users.ps1 file and click on execute with Powershell
- Enter your Office365 Admin Credentials and press OK
- After this your Users from the csv file will be created on the Office365 Server.
If you are unsure if you are conntected to your Office365 Server you can test it with the command get-msoluser. If connected this lists all Office365 Users.
The Powershellcode from the file Office365_create_new_Users.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#Adrian Reinhard, reinhard.be - 22.03.2017 #Create a new O365 Useraccount #1. Please edit your users.csv and save it here C:\Office365\users.csv #2. start Azure Powershell with admin privileges Import-Module MSOnline $O365Cred = Get-Credential $O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $O365Cred -Authentication Basic -AllowRedirection Import-PSSession $O365Session -AllowClobber Connect-MsolService –Credential $O365Cred $AllOffice365Users = Import-CSV C:\Office365\Users.CSV $AllOffice365Users | ForEach-Object {New-MsolUser -UserPrincipalName $_.UserPrincipalName -FirstName $User.FirstName -LastName $User.LastName -DisplayName $_.DisplayName -Password $_.UserPassword -LicenseAssignment "rykartarchitekten:SMB_BUSINESS_PREMIUM" -UsageLocation CH} | Export-CSV C:\Office365\NewOffice365UsersWithPassword.CSV -NoTypeInformation |
Error: Contact form not found.