PS C:\Windows\system32> Set-MsolUserPrincipalName -UserPrincipalName first.last_contoso-1@Company portal .onmicrosoft.com -NewUserPrincipalName first.last@Company portal .com
Set-MsolUserPrincipalName : Access Denied. You do not have permissions to call this cmdlet.
At line:1 char:1
- Set-MsolUserPrincipalName -UserPrincipalName first.last_contoso-1@Company portal ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : OperationStopped: (:) [Set-MsolUserPrincipalName], MicrosoftOnlineException
- FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.UserNotFoundException,Microsoft.Online.Administration.Automation.SetUserPrincipalName
I am a global admin, so I know I am supposed to have the appropriate permissions and should not be getting an access denied.
I am not sure where the Get-Recipient command draws the name from, but the UPN seems to be correct for this user, it is a different naming designation that is mismatched. His mail works fine, he can use all the SSO login just fine. The only thing that doesn't seem to connect right is the attributes from the on-site DC to Exchange online. All the "first.last_contoso-1" should just be "first.last"
When I run the command: Get-Recipient -Identity 'first.last_contoso-l' | format-list
the results are below:
Identity : first.last_contoso-l
Alias : first.last
ArchiveGuid : -------Removed----
AuthenticationType : Managed
City :
Notes :
Company :
CountryOrRegion :
PostalCode :
CustomAttribute1 :
CustomAttribute2 :
CustomAttribute3 :
CustomAttribute4 :
CustomAttribute5 :
CustomAttribute6 :
CustomAttribute7 :
CustomAttribute8 :
CustomAttribute9 :
CustomAttribute10 :
CustomAttribute11 :
CustomAttribute12 :
CustomAttribute13 :
CustomAttribute14 :
CustomAttribute15 :
ExtensionCustomAttribute1 : {}
ExtensionCustomAttribute2 : {}
ExtensionCustomAttribute3 : {}
ExtensionCustomAttribute4 : {}
ExtensionCustomAttribute5 : {}
Database : -------Removed----
ArchiveDatabase : -------Removed----
DatabaseName : Databases-------Removed----
Department :
ExternalDirectoryObjectId : -------Removed----
ManagedFolderMailboxPolicy :
EmailAddresses : {SMTP:first.last@Company portal .com, SIP:first.last@Company portal .com, smtp:first.last@Company portal .onmicrosoft.com, SPO:SPO_-------Removed----
ExpansionServer :
ExternalEmailAddress :
DisplayName : first last
FirstName : first
HiddenFromAddressListsEnabled : True
EmailAddressPolicyEnabled : False
IsDirSynced : True
LastName : last
ResourceType :
ManagedBy : {}
Manager :
ActiveSyncMailboxPolicy : Default
ActiveSyncMailboxPolicyIsDefaulted : True
Name : first.last_contoso-l
Office :
ObjectCategory : -------Removed----.PROD.OUTLOOK.COM/Configuration/Schema/Person
OrganizationalUnit : -------Removed----.prod.outlook.com/Microsoft Exchange Hosted Organizations/contoso.onmicrosoft.com
Phone :
PoliciesIncluded : {}
PoliciesExcluded : -------Removed----
PrimarySmtpAddress : ******@taktl-llc.com
RecipientType : UserMailbox
RecipientTypeDetails : UserMailbox
SamAccountName : -------Removed----
ServerLegacyDN : -------Removed----
ServerName : -------Removed----
StateOrProvince :
StorageGroupName : Databases
Title :
UMEnabled : False
UMMailboxPolicy :
UMRecipientDialPlanId :
WindowsLiveID : first.last@Company portal .com
HasActiveSyncDevicePartnership : True
AddressListMembership : {\All Mailboxes(VLV), \All Recipients(VLV)}
OwaMailboxPolicy : OwaMailboxPolicy-Default
AddressBookPolicy :
InformationBarrierSegments : {}
WhenIBSegmentChanged :
SharingPolicy : Default Sharing Policy
RetentionPolicy : Default MRM Policy
ShouldUseDefaultRetentionPolicy : False
MailboxMoveTargetMDB :
MailboxMoveSourceMDB :
MailboxMoveFlags : None
MailboxMoveRemoteHostName :
MailboxMoveBatchName :
MailboxMoveStatus : None
MailboxRelease :
ArchiveRelease :
IsValidSecurityPrincipal : True
LitigationHoldEnabled : False
Capabilities : {BPOS_S_Standard, SBRM, BPOS_S_BookingsAddOn, MYANALYTICSP2...}
RootCapabilities : BPOS_S_Standard
ArchiveState : Local
SKUAssigned : True
WhenMailboxCreated : 8/28/2017 2:01:27 PM
UsageLocation : United States
ExchangeGuid : -------Removed----
ArchiveStatus : Active
SafeSendersHash : -------Removed----
SafeRecipientsHash : -------Removed----
BlockedSendersHash : -------Removed----
WhenSoftDeleted :
UnifiedGroupSKU :
ExchangeVersion : 0.20 (15.0.0.0)
DistinguishedName : CN=first.last_taktl-l,OU=contoso.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=-------Removed----,DC=PROD,DC=OUTLOOK,DC=COM
ObjectClass : {top, person, organizationalPerson, user}
WhenChanged : 11/20/2022 6:51:29 PM
WhenCreated : 8/28/2017 2:01:28 PM
WhenChangedUTC : 11/20/2022 11:51:29 PM
WhenCreatedUTC : 8/28/2017 6:01:28 PM
ExchangeObjectId : -------Removed----
OrganizationalUnitRoot : contoso.onmicrosoft.com
OrganizationId : -------Removed----.PROD.OUTLOOK.COM/Microsoft Exchange Hosted Organizations/contoso.onmicrosoft.com - -------Removed----.PROD.OUTLOOK.COM/ConfigurationUnits/contoso.onmicrosoft.com/Configuration
Id : first.last_contoso-l
Guid : -------Removed----
OriginatingServer : -------Removed----
IsValid : True
ObjectState : Unchanged