Creating Users in an Azure AD in Bulk


As part of the Unicorn Project i need to create a bunch of users en mass in my AAD.

Turns out it is with Excel is actually very easy.

Step 1. Download Microsoft Online Services Sign-In Assistant for IT Professionals RTW

https://www.microsoft.com/en-us/download/confirmation.aspx?id=41950

 

(note i have found an issue when installing the AD module it is not ‘seeing’ the in Sign in Assistant and using the beta resolved it:

https://www.microsoft.com/en-us/download/details.aspx?id=39267 )

 

Step 2 Download Azure Active Directory Module for Windows PowerShell

Azure Active Directory Module for Windows PowerShell (64-bit version)

Step 3 I created a quick XLS to create the New-MsolService Commands

Here is the formula i used:

=”New-MsolUser -UserPrincipalName ” & B1 & “@partsunlimited.onmicrosoft.com -DisplayName ” & B1 & ” -FirstName ” & B1 & ” -LastName ” & B1 & ” -Password  ” & C1 & ”  -PasswordNeverExpires $true -AlternateEmailAddresses chass@microsoft.com”

Step 4 Run the following Powershell Commands in Azure Power shell console

Get-Credential

Connect-MsolService

Paste in the values from Excel…like the following:

New-MsolUser -UserPrincipalName Unicorn131@partsunlimited.onmicrosoft.com -DisplayNameUnicorn131 -FirstName Unicorn131 -LastName Unicorn131 -Password Password1 -PasswordNeverExpires $true -AlternateEmailAddresses chass@microsoft.com

 

 

 

Not certain why comments keep disappearing so adding to the post:

If you want to assign a Power BI to that user it is:

New-MsolUser -UserPrincipalNameDIADUSER25@powercommunity.onmicrosoft.com -DisplayName DIADUSER24 -FirstName DIADUSER24 -LastName DIADUSER24 -Password  somePassword  -PasswordNeverExpires $true -AlternateEmailAddresse
s chass@microsoft.com -Country ‘United States’ -LicenseAssignment powercommunity:POWER_BI_STANDARD -UsageLocation US

 


Comments (5)

  1. Charles sterling says:

    Now that the lab is over i need to reset all the passwords of those accounts.

    This command seems to do the trick:

    Set-MSOLUserPassword -UserPrincipalName Unicorn1@partsunlimited.onmicrosoft.com -NewPassword Mynewpassword

  2. Now that the lab is over i needed to reset all 100 of those accounts…this seemed to do the trick

    Set-MSOLUserPassword -UserPrincipalName Unicorn22@partsunlimited.onmicrosoft.com -NewPassword Newpassword

  3. If you want to assign a Power BI to that user it is:
    PS C:\windows\system32> New-MsolUser -UserPrincipalName DIADUSER25@powercommunity.onmicrosoft.com -DisplayName DIADUSER24 -FirstName DIADUSER24 -LastName DIADUSER24 -Password  somePassword  -PasswordNeverExpires $true -AlternateEmailAddresse
    s chass@microsoft.com -Country ‘United States’ -LicenseAssignment powercommunity:POWER_BI_STANDARD -UsageLocation US

  4. Charles Sterling says:

    # Connect to EXO
    $creds = Get-Credential
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange `
    -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
    -Credential $creds -Authentication Basic -AllowRedirection
    Import-PSSession $Session

    # Disable
    Set-OwaMailboxPolicy -Identity OwaMailboxPolicy-Default -GroupCreationEnabled $false

    Remove-PSSession $Session

Skip to main content