Remove a second address from your O365 mailbox

Asset 18

How to remove an alias stuck in Office 365

Posted on 31 July 2019 by Beaming Support

Are you trying to remove an alias from an Office 365 mailbox/shared mailbox?

This can be an issue if the mailbox was originally created with the email address that you now want to move over to a separate mailbox. The issue is that when the account is first created it ties the email address into the user principal name (UPN) of the account, therefore when you try to remove the “alias” it will only re-appear again as it won’t let you remove the default UPN. This guide demonstrates how to change the UPN to the desired email address using some Powershell commands.

Step 1

Connect to Office 365 via Powershell using the following commands.

$UserCredential = Get-Credential

(This will then prompt for credentials, which will be the Office 365’s admin email address and password).

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic –AllowRedirection

Import-PSSession $Session –DisableNameChecking

Step 2

Once connected, it is advisable to do a “Get-Mailbox” command to ensure that you are logged in correctly and are in the correct Office 365 session. This will essentially list all of the mailboxes associated to that Office 365 admin panel.

Step 3

Then you can check the specific mailbox using the following command.

Get-Mailbox test@domain.com

Step 4

You will need to connect to the MsolService to firstly check the mailbox’s User Principal Name and then change it. To connect the command is:

Connect-MsolService

Step 5

Now you are connected, you will firstly need to look at the mailbox you want to remove the alias from in more detail by using the following.

Get-Mailbox “test@domain.com” | Format-List

Step 6

In the list, you will need to locate the “UserPrincipalName”, which currently matches the alias you want to remove. The way to change this is to do the following.

Set-MsolUserPrincipalName -UserPrincipalName “Current@userprincipalname.com” -NewUserPrincipalName required@userprincipalname.com.

Step 7

Now run the Get-Mailbox “test@domain.com” | Format-List command again and you should see the updated user principal name. You can now remove the alias from the Office 365 admin portal and reassign it where needed. Note that this may take a while to take effect, so if it does not work immediately wait up to 1 full hour for the change to be fully completed before trying again.

Subscribe & get a free Business Guide to Cyber Security

We’ll pop up in your inbox once a month with:

-Cyber security guidance for users of all ability levels

-FAQs from our technical support desk

-Quick tips that boost efficiency & productivity

And we’ll send you our Business Guide to Cyber Security for free, as soon as you sign up.

Latest tech support posts – shared monthly!

Get all the latest tech support answers drop straight in your inbox. Sign up to our email round up. Add your email address below

  • This field is for validation purposes and should be left unchanged.