forked from tomwechsler/Azure_PowerShell_Administration
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path10_UserOperations_tw.ps1
More file actions
38 lines (31 loc) · 914 Bytes
/
10_UserOperations_tw.ps1
File metadata and controls
38 lines (31 loc) · 914 Bytes
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
Clear-Host
Set-Location c:\
#Log into Azure
Connect-AzureAD
$domain = "wechsler.onmicrosoft.com"
$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
$PasswordProfile.Password = "agxsFX72xwsSAi"
#Find an existing user
Get-AzureADUser -SearchString "FR"
Get-AzureADUser -Filter "State eq 'SO'"
#Creating a new user
$user = @{
City = "Oberbuchsiten"
Country = "Switzerland"
Department = "Information Technology"
DisplayName = "Fred Prefect"
GivenName = "Fred"
JobTitle = "Azure Administrator"
UserPrincipalName = "frPrefect@$domain"
PasswordProfile = $PasswordProfile
PostalCode = "4625"
State = "SO"
StreetAddress = "Hiltonstrasse"
Surname = "Prefect"
TelephoneNumber = "455-233-22"
MailNickname = "FrPrefect"
AccountEnabled = $true
UsageLocation = "CH"
}
$newUser = New-AzureADUser @user
$newUser | Format-List