Create OnCloud User for Specific Domain- Custom Action

Modified on Thu, 03 Nov 2022 at 09:54 AM

If you are looking for a way to create cloud user for a specific domain you can use the following:


Please note the following:

  • Variable set as input in the Custom action
  • Domain can't be change by the Operator (restricted by the script)


Sample Script:

$UserPincipalName = $UPN+'@M365x795031.OnMicrosoft.com'

$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
$PasswordProfile.Password = $Password
New-AzureADUser -DisplayName $DisplayName -PasswordProfile $PasswordProfile -UserPrincipalName $UserPincipalName -AccountEnabled $true -MailNickName $UPN


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article