-
Notifications
You must be signed in to change notification settings - Fork 62
/
12_PopulateUsers_tw.ps1
41 lines (33 loc) · 1.03 KB
/
12_PopulateUsers_tw.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Clear-Host
Set-Location c:\
#Install AzureAD if doesn't exist
if(-not (Get-Module AzureAD)){
Install-Module -Name AzureAD -Force
}
#Log into Azure
Connect-AzureAD
cd D:\Scripts
$data = import-csv -Path .\Fake_User_data.csv
$domain = "wechsler.onmicrosoft.com"
$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
$PasswordProfile.Password = "agxsFX72xwsSAi"
foreach($item in $data){
$user = @{
City = $item.City
Country = $item.Country
Department = $item.Department
DisplayName = "$($item.GivenName) $($item.Surname)"
GivenName = $item.GivenName
JobTitle = $item.Occupation
UserPrincipalName = "$($item.Username)@$domain"
PasswordProfile = $PasswordProfile
PostalCode = $item.ZipCode
State = $item.State
StreetAddress = $item.StreetAddress
Surname = $item.Surname
TelephoneNumber = $item.TelephoneNumber
MailNickname = $item.Username
AccountEnabled = $true
}
New-AzureADUser @user
}