Skip to content

Instantly share code, notes, and snippets.

@PCfromDCSnippets
Last active December 15, 2017 16:47
Show Gist options
  • Save PCfromDCSnippets/bfc55afabff7fb56bd12d9891849506b to your computer and use it in GitHub Desktop.
Save PCfromDCSnippets/bfc55afabff7fb56bd12d9891849506b to your computer and use it in GitHub Desktop.
Create MSOL User
Param (
[string]$displayName = "SVC-Nework-Gateway-Updater",
[string]$firstName = "Network-Gateway",
[string]$lastName = "Updater-Account",
[string]$upn = "svc_network-updater@yourDomain.onmicrosoft.com",
[string]$password = "MyPassword#12345",
[string]$usageLocation = "US"
)
$oCred = Get-Credential -Message "Enter Admin Credentials for O365..."
Connect-MsolService -Credential $oCred
$user = New-MsolUser -DisplayName $displayName `
-FirstName $firstName `
-LastName $lastName `
-UserPrincipalName $upn `
-UsageLocation $usageLocation `
-ForceChangePassword:$false `
-PasswordNeverExpires:$true `
-Password $password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment