Always Beyond Team
Managed IT Services

If you manage Microsoft 365 for your organization, knowing how to connect to Exchange Online PowerShell is one of the most valuable skills in your IT toolkit. Whether you need to bulk-manage mailboxes, configure mail flow rules, troubleshoot delivery issues, or automate repetitive tasks, PowerShell gives you capabilities that the Exchange admin center simply cannot match. This guide walks you through everything you need to know — from prerequisites to advanced connection scenarios — so your team can start managing Exchange Online like pros.
Exchange Online PowerShell is a command-line interface that allows administrators to manage Exchange Online, the cloud-hosted email service included in Microsoft 365 (formerly Office 365). Unlike the graphical Exchange admin center (EAC), PowerShell lets you automate bulk operations, write scripts for recurring tasks, access settings not exposed in the GUI, and build integrations with other systems.
When you connect to Exchange Online PowerShell, you are establishing a remote PowerShell session directly to Microsoft's Exchange Online infrastructure. This gives your team granular control over every aspect of your email environment — mailboxes, distribution groups, mail flow rules, anti-spam policies, and much more.
Microsoft has been transitioning administrators from the legacy basic authentication (basic auth) remote PowerShell connection method to the newer, more secure Exchange Online PowerShell V3 module (EXO V3). The V3 module uses modern authentication (OAuth 2.0 / MFA support) and is now the only officially supported method. Basic authentication was deprecated by Microsoft in late 2022.
| Feature | Legacy Remote PowerShell | EXO V3 Module |
|---|---|---|
| Authentication | Basic auth (username/password) | Modern auth (OAuth 2.0 / MFA) |
| MFA Support | No | Yes |
| REST API Backend | No | Yes (faster cmdlets) |
| Certificate Auth | No | Yes |
| App-only / Unattended | Limited | Full support |
| Current Support Status | Deprecated | Active / Recommended |
Before your team attempts to connect to Exchange Online PowerShell, make sure the following requirements are in place.
Open PowerShell as an administrator and run the following command to install the latest version of the EXO V3 module from the PowerShell Gallery:
Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber
If the module is already installed and you want to update to the latest version, run:
Update-Module -Name ExchangeOnlineManagement
To verify the installed version, use:
Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name, Version
Once installed, import the module into your current PowerShell session:
Import-Module ExchangeOnlineManagement
In most cases PowerShell will auto-import modules from the Gallery, but explicitly importing ensures you are using the correct version.
The standard interactive connection command is:
Connect-ExchangeOnline -UserPrincipalName admin@yourdomain.com
Replace admin@yourdomain.com with your Microsoft 365 admin account UPN. A browser window or in-app prompt will appear asking you to sign in with your credentials and complete MFA if required. Once authenticated, your PowerShell session will be connected to Exchange Online and you can begin running cmdlets.
After connecting, verify the session is active and working by running a simple test cmdlet:
Get-Mailbox -ResultSize 5
This should return up to five mailboxes from your Exchange Online environment. If you see results, your connection is successful.
You are now connected and ready to manage your Exchange Online environment. Common tasks include listing all mailboxes, managing distribution groups, setting mailbox permissions, configuring mail flow rules, and much more — all from the command line.
When you finish your administrative work, always disconnect your session to free resources and maintain security hygiene:
Disconnect-ExchangeOnline -Confirm:$false
For scripts that run on a schedule — such as nightly reports or automated mailbox provisioning — interactive login is not practical. The EXO V3 module supports two primary methods for unattended connections.
This is the recommended approach for automation. You register an Azure AD application, assign it Exchange Online permissions (using application permissions, not delegated), and authenticate using a certificate rather than user credentials. The connection command looks like this:
Connect-ExchangeOnline -AppId "your-app-id" -CertificateThumbprint "your-cert-thumbprint" -Organization "yourdomain.onmicrosoft.com"
If your scripts run inside Azure Automation or Azure Functions with a managed identity, you can leverage the managed identity for certificate-based authentication without storing credentials anywhere.
The ExchangeOnlineManagement module fully supports PowerShell 7 on macOS and Linux. The installation and connection process is identical — install the module via Install-Module, then use Connect-ExchangeOnline. This is particularly useful for DevOps teams and administrators who prefer cross-platform tooling.
This means the ExchangeOnlineManagement module is not installed or not imported. Run Install-Module -Name ExchangeOnlineManagement followed by Import-Module ExchangeOnlineManagement.
Your account does not have the required Exchange Online administrator role. Work with your Global Administrator to assign the Exchange Administrator or appropriate role in the Microsoft 365 admin center.
This is an MFA-related error. Ensure you are using an account that can complete MFA, and that your Conditional Access policies allow PowerShell access from your current location or device.
You have an existing session open. Run Disconnect-ExchangeOnline -Confirm:$false first, then reconnect.
Yes. You need to install the ExchangeOnlineManagement module from the PowerShell Gallery using Install-Module -Name ExchangeOnlineManagement. Beyond that, you need PowerShell 5.1 or later and a Microsoft 365 account with appropriate admin permissions. No additional software or Exchange server is required — everything runs through the cloud.
Absolutely. The EXO V3 module (ExchangeOnlineManagement) was specifically designed to support modern authentication, which includes multi-factor authentication. When you run Connect-ExchangeOnline, a browser prompt or in-app authenticator request will appear for you to complete your MFA challenge. This is the recommended and most secure way to connect interactively.
For unattended or automated scripts, you should use app-only authentication. Register an application in Azure Active Directory (Microsoft Entra ID), grant it the appropriate Exchange Online application permissions, create a certificate, and use the -AppId and -CertificateThumbprint parameters with Connect-ExchangeOnline. This allows your scripts to authenticate automatically without any interactive prompt.
No, they are different tools. The on-premises Exchange Management Shell (EMS) is used to manage Exchange Server installed in your own data center. Exchange Online PowerShell connects to Microsoft's cloud-hosted Exchange Online service. While many cmdlet names are similar, their parameters and available options differ. You cannot use the on-premises EMS to manage Exchange Online, and vice versa.
Run the command Get-Module ExchangeOnlineManagement -ListAvailable | Select-Object Name, Version in PowerShell to see the installed version. You can also check with Get-InstalledModule -Name ExchangeOnlineManagement. Compare the output against the latest version on the PowerShell Gallery (gallery.powershellgallery.com/packages/ExchangeOnlineManagement) to see if an update is available. Always keep the module current to benefit from the latest performance improvements and security fixes.
Knowing how to connect to Exchange Online PowerShell is just the beginning. Once your team is comfortable with the basics, you can automate mailbox provisioning, build compliance reporting, manage mail flow at scale, and integrate Exchange Online administration into your broader IT operations workflows. The efficiency gains are significant — tasks that would take hours in the GUI can run in seconds through a well-crafted script.
At Always Beyond, we help organizations get the most out of their Microsoft 365 investment. Whether you need help setting up Exchange Online automation, tightening your email security posture, or building managed IT operations that scale — our team is ready to help. Get in touch with Always Beyond today and let's build an IT environment that works as hard as you do.
See exactly how your current IT setup measures up to our Hack Free standards. Enter your business email to receive: