Forum Discussion
Changing UPNs / Domains
Seems you are trying to change between federated/managed domains, thus the error. A federated user does not have any password set in the service, so you need to perform some actions when converting it (similar to what Convert-MsolFederatedUser does). So this will not work for federated:
# Set-AzureADUser -ObjectId e53d644c-db69-4e19-a1ab-94bd1f5d11e4 -UserPrincipalName irestri@michevdev2.onmicrosoft.com
Set-AzureADUser : Error occurred while executing SetUser
Code: Request_BadRequest
Message: Property passwordProfile.password value is required but is empty or missing.
This will:
# $PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
# $PasswordProfile.Password = "Password123"
# Set-AzureADUser -ObjectId e53d644c-db69-4e19-a1ab-94bd1f5d11e4 -UserPrincipalName irestri@michevdev2.onmicrosoft.com -PasswordProfile $PasswordProfile
- C_the_SApr 19, 2017Bronze Contributor
Sorry, but having to change a user's password is unacceptable.
- VasilMichevApr 19, 2017MVP
Well IF you are changing between federated/managed auth, it's mandatory.
- C_the_SApr 19, 2017Bronze Contributor
Nope, it isn't mandatory.
Based on the other script given to me by NunoAriasSilva here are the commands I ended up using that did NOT require reseting the user's password.
Set-MsolUserPrincipalName -UserPrincipalName User1@contoso.com -NewUserPrincipalName User1@tenantname.onmicrosoft.com
Set-MsolUserPrincipalName -UserPrincipalName User1@tenantname.onmicrosoft.com -NewUserPrincipalName User1@Fabrikam.comThat support article definitely needs some updating.