Detecting and Remediating Plus Addresses in Exchange Online

In a recent Message Center announcement (MC276028), Microsoft have communicated that the Plus Addressing feature which I wrote about previously will be turned on for all tenancies in January 2022. This is a good move that brings Exchange Online in line with a lot of other email systems. Previously, Plus addressing was an opt-in feature, allowing organizations who users the ‘+’ symbol in email aliases a little time to take stock of the addresses in use in their environment, as this feature essentially breaks these addresses.

With a deadline now set before this is enabled for all tenants, it’s definitely time to verify (if you haven’t already) what addresses are in use in your tenancy. To help with this I have put together a very simple Exchange Online PowerShell script to surface this information quickly.

Note: It’s not currently possible to assign an address with a ‘+’ in it through the GUI but it can be done via PowerShell or via AD Connect.

Running the Script

In order to run the script, you’ll need to install the Exchange Online Management (v2) PowerShell Module and have a minimum of the Recipient Management role group assigned to your account. To run it, copy script (below) into your PowerShell window or chosen editor. You will be prompted for credentials to sign in to your tenant and then the script will gather the data.

Connect-ExchangeOnline

$recipients = Get-EXORecipient -ResultSize unlimited

$results = @()
foreach($recipient in $recipients){

    if($recipient.emailaddresses -like "*+*"){

        $Result = New-Object PSObject
        $Result | Add-Member NoteProperty Displayname($recipient.DisplayName)
        $Result | Add-Member NoteProperty ObjectType($recipient.RecipientTypeDetails)
        $Result | Add-Member NoteProperty PrimaryAddress($recipient.PrimarySmtpAddress)
        $Result | Add-Member NoteProperty AddressDetected($recipient.EmailAddresses | ?{$_ -like "*+*"})
    
        $results += $Result
        Remove-Variable result
    }

}

$results | Export-Csv "PlusAddressReport.csv" -Append -NoTypeInformation

When it runs, the script returns all recipients (remember, we aren’t just looking at mailboxes here – groups too!) and checks each of them for the ‘+’ sign in the email addresses. When detected, a variable is appended to an overall collection containing the Display Name, Recipient Type Details, Primary SMTP Address and the specific address that’s assigned. This gives all the information needed to locate the usage of ‘+’ in the organization.

At the end, the collection will export into the current directory of the PowerShell window a CSV (Figure 1) containing a list of all the above information for review / remediation.

Figure 1: CSV output shows any object that has a ‘+’ in an email alias

Summary

This is a very quick and simple script that has saved me a lot of time over multiple customer tenancies. Hopefully it can ease the process for others too!

By the way, if you’re not familiar with plus addressing, I recommend checking out my original article as it has a lot of use cases, particularly in large organizations. At a minimum, it’s always best to turn these features on manually in a controlled manner rather than wait for them to happen!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s