In Azure AD, the UserPrincipalName (UPN) can be manually updated using Set-MsolUserPrincipalName Power Shell cmdlet.  The details and syntax are explained here – https://msdn.microsoft.com/en-us/library/azure/dn194135.aspx

One of the common issues you experience during this process is the “Access Denied”  error message. 

 Set-MsolUserPrincipalName : Access Denied. You do not have permissions to call this cmdlet

If you are using Global Administrator account, you should have permission to update user properties. This error message can be little misleading.  Most of the time, you will see this error message because of an non-existent UPN name in the “-UserPrincipalName” parameter.

Set-MsolUserPrincipalName -UserPrincipalName CurrentUPNfromAzure@domain.onmicrosoft.com -NewUserPrincipalName NewUPN@mydomain.com

Here are some examples:

As you can see in the following screenshot, I am getting the Set-MsolUserPrincipalName : Access Denied. You do not have permissions to call this cmdlet message here.  

image

I am using a Global Administrator account here.  This is because of the non-existent UPN (current UPN of the user from Azure).  If you run Get-MsolUser cmdlet, you will see the real error message 🙂   “Get-MsolUser : User Not Found.  User: Client2User200@myinfralab.onmicrosoft.com” error message. 

image

You need to verify current Azure UPN before you the Set-MsolUserPrincipalName or you can combine Get-MsolUser and  Set-MsolUserPrincipalName cmdlets to include this validation check to get some more meaningful error message. 

Get-MsolUser -UserPrincipalName CurrentUPNfromAzure@domain.onmicrosoft.com | Set-MsolUserPrincipalName -NewUserPrincipalName NewUPN@mydomain.com

image 

Also, make sure to verify the Custom Domain in Azure if you are planning to use a custom domain name as UPN.

image image

http://www.amazon.com/dp/1849687447/?tag=packtpubli-20

Powered by WPeMatico

Categories: Microsoft

Related Posts

Microsoft

Azure Password Reset – The Password you’ve selected does not meet your Active Directory password policy

This is a common error message when you try to reset a password from Azure management port or Self service portal.  The error message is very clear here – “The Password you’ve selected does not Read more…

Microsoft

Azure – Your account is temporarily locked to prevent unauthorized use

Here is the another common error message when dealing with directory and password synchronization.  Error Message: Your account is temporarily locked to prevent unauthorized use. Try again later. Contact Customer Support if the problem persists Read more…

Microsoft

Verify Service Status Remotely Using Local Account – PowerShell Script

I have modified one of my previously published script – Stop, Start, Disable Service Remotely–PowerShell Script (http://portal.sivarajan.com/2011/05/stop-start-disable-service.html) to use Local account (instead of a domain account) to verify the status of the service.   Input Read more…