Exchange Online PowerShell command builder
Fill in the details and copy the commands – for the Microsoft 365 email settings that are hardest to find in the admin centers.
Commands
Run these in PowerShell 7 (or Windows PowerShell 5.1) as an Exchange administrator. Click to copy.
Rather not manage SMTP AUTH exceptions and app registrations?
Auth-Email connects your apps, printers and scripts to Microsoft 365 with OAuth – no SMTP AUTH exceptions, relay connectors or app-only permissions to maintain, and nothing to change when Microsoft retires password sign-in.
Frequently asked questions
How do I connect to Exchange Online PowerShell?
Install the ExchangeOnlineManagement module with Install-Module -Name ExchangeOnlineManagement, then run Connect-ExchangeOnline -UserPrincipalName [email protected] and sign in as an Exchange administrator.
Why does New-ServicePrincipal fail, or app-only access not work?
The most common mistake is using the app registration’s object ID. New-ServicePrincipal needs the object ID of the Enterprise application (the service principal) – find it under Enterprise applications in the Microsoft Entra admin center.