Azure Active Directory \ Create User

This is a way to create user account in batches. There can be more attributes added to the script to populate more fields. I just wanted to get a good example for my records.  

# Import User Account Information From CSV

$MyAccounts=Import-csv "C:\Users\scott\AzureAD\Accounts.csv" -ErrorAction Stop

# Syntax / Technical Formatting of Password from String 

$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile

# Da Loop Through the CSV Data

Foreach($Account in $MyAccounts){  

     

    # Assign Password from CSV to Variable 

    $PasswordProfile.Password = $Account.PasswordProfile

    # Create New Account in AAD 

    New-AzureADUser -DisplayName  $Account.DsiplayName -GivenName  $Account.GivenName -SurName  $Account.Surname -UserPrincipalName  $Account.UserPrincipalName -MailNickName  $Account.MailNickName -PasswordProfile  $PasswordProfile -JobTitle $Account.JobTitle -AccountEnabled  $True
        
}

CSV used in Script with Headers

Azure_AD_Users.PNG

Output in PowerShell | Results

User_Results.PNG