Hello,
I'm trying current creating a AD User Account on Azure via Powershell and here is the command I'm trying to run
Connect-AzAccount
Generate Password Profile
$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
$PasswordProfile.Password = "IT0psT@lk"
New ADUser Parameters
$params = @{
AccountEnabled = $true
DisplayName = "Test User"
PasswordProfile = $PasswordProfile
UserPrincipalName = "******@onmicrosoft.com"
MailNickName = "TestUser"
}
New-AzADUser @params
and getting this error after running the command
New-AzADUser : Cannot process argument transformation on parameter 'PasswordProfile'. Cannot convert the "class PasswordProfile {
Password: Qwerty12356!
ForceChangePasswordNextLogin:
EnforceChangePasswordPolicy:
}
" value of type "Microsoft.Open.AzureAD.Model.PasswordProfile" to type
"Microsoft.Azure.PowerShell.Cmdlets.Resources.MSGraph.Models.ApiV10.IMicrosoftGraphPasswordProfile".
At C:\Users\Vert\Documents\WindowsPowerShell\Scripts\Create New User.ps1:16 char:14
- New-AzADUser @params
- ~~~~~~~
- CategoryInfo : InvalidData: (:) [New-AzADUser], ParameterBindingArgumentTransformationException
- FullyQualifiedErrorId : ParameterArgumentTransformationError,New-AzADUser
Hope you could help me figure this out. Thank you