Create on-cloud user for specific domain

  • Last update on August 8th, 2024

Table of Contents

Custom actions are not available in the Essentials solution.

 

If you are a Tenant Admin and need to create a cloud user for a specific domain, you can use the CoreView custom action script below.

Please note:

  • You must set the variable as input for the custom action
  • You can't change the domain (it's restricted by the script)
 

Custom action 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