Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Fix “Connect-SPOService Is Not Recognized” in PowerShell

Red text on the first line of a SharePoint admin script stings, especially when the same command worked last week. Usually the SharePoint Online Management Shell is installed, and PowerShell just isn’t loading it.

In this tutorial, we’ll fix Connect-SPOService is not recognized in four steps: confirm the module is there, import it, install or update it, and connect. We reproduced each case on 10/25/2026 in PowerShell 7.6.7 and Windows PowerShell 5.1.

Quick answer: PowerShell can’t find the Microsoft.Online.SharePoint.PowerShell module in this session. Run Import-Module Microsoft.Online.SharePoint.PowerShell; if that fails, install it with Install-Module Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser, then run Connect-SPOService with your -admin URL.

What You Need Before You Start

  • The SharePoint Administrator role (or SharePoint Embedded Administrator). Connect-SPOService won’t sign in other accounts.
  • Your admin center URL, which ends in -admin.sharepoint.com.
  • PowerShell 7 or Windows PowerShell 5.1, with rights to install a module for your own account.

Is the error about Connect-PnPOnline instead? That’s a different module, so follow our Connect-PnPOnline is not recognized fix. For a side-by-side of both modules, see how to connect to SharePoint Online using PowerShell.

Step 1: Confirm the Error and Check the Module

Here’s what a fresh PowerShell 7.6.7 window showed us for a plain connect command:

Connect-SPOService -Url "https://spguides-admin.sharepoint.com"
The term 'Connect-SPOService' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Connect-SPOService is not recognized as a name of a cmdlet error in PowerShell 7.6.7

Windows PowerShell 5.1 words it as “the name of a cmdlet … or operable program,” but the cause is the same. Next, ask PowerShell three questions: is the module installed, is it loaded, and can it find the cmdlet?

"PowerShell $($PSVersionTable.PSVersion)"

# 1. Is the module installed, and where?
Get-Module -ListAvailable -Name Microsoft.Online.SharePoint.PowerShell |
    Format-Table Version, ModuleBase -AutoSize

# 2. Is it loaded in this session?
"Loaded: " + [bool](Get-Module -Name Microsoft.Online.SharePoint.PowerShell)

# 3. Can PowerShell find the cmdlet?
"Found Connect-SPOService: " + [bool](Get-Command Connect-SPOService -ErrorAction SilentlyContinue)
Get-Module ListAvailable showing two SharePoint Online Management Shell versions, Loaded False and Found Connect-SPOService False

Our PC had two copies: 16.0.27424.12000 from the PowerShell Gallery and 16.0.27424.0 from the MSI installer in C:\Program Files\SharePoint Online Management Shell. Yet the module wasn’t loaded, and PowerShell 7 couldn’t find the cmdlet.

If the table comes back empty, the module isn’t installed for this shell. Jump to Step 3.

Step 2: Import the Module in PowerShell 7

When the module is listed but not loaded, import it by name. If something is broken, Import-Module prints the real load error:

Import-Module Microsoft.Online.SharePoint.PowerShell

Get-Command Connect-SPOService | Format-Table Name, Source, Version -AutoSize
"SPO cmdlets now available: " + (Get-Command -Module Microsoft.Online.SharePoint.PowerShell).Count
Import-Module Microsoft.Online.SharePoint.PowerShell making Connect-SPOService available with 362 SPO cmdlets

After the import, Connect-SPOService came from version 16.0.27424.12000 and 362 SPO cmdlets were available, with no warning. Microsoft’s getting-started page tells PowerShell 7 users to import with -UseWindowsPowerShell. Use that if the plain import throws an error:

Import-Module Microsoft.Online.SharePoint.PowerShell -UseWindowsPowerShell

Step 3: Install or Update the Module

No module listed? Install it from the PowerShell Gallery. With -Scope CurrentUser, you don’t need admin rights. We previewed the install with -WhatIf, so nothing changed on our PC:

# Not installed at all? Install it for your account (no admin rights needed)
Find-Module -Name Microsoft.Online.SharePoint.PowerShell | Format-Table Name, Version, Repository -AutoSize

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser -WhatIf
Find-Module showing SharePoint Online Management Shell 16.0.27709.12000 and Install-Module Scope CurrentUser WhatIf preview

The Gallery offered 16.0.27709.12000, newer than both installed copies. Newer builds add cmdlets and parameters, so update now and then:

Update-Module -Name Microsoft.Online.SharePoint.PowerShell

Installed it but still get the error? Check that the module’s folder is one PowerShell searches. When we limited PSModulePath to the built-in folder, the same “not recognized” error came back:

$env:PSModulePath -split ';'

Step 4: Connect to the SharePoint Admin Center

With the module loaded, connect to the -admin URL. A Microsoft sign-in window opened once, and a second run 10 minutes later connected without a prompt:

Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url "https://spguides-admin.sharepoint.com"

Get-SPOSite -Identity "https://spguides.sharepoint.com/sites/SPGuides" |
    Format-List Url, Title, Template, LockState, StorageUsageCurrent
PowerShell 7 connected with Connect-SPOService and Get-SPOSite returning the SPGuides site with template GROUP#0

Get-SPOSite returned our SPGuides site: template GROUP#0, LockState Unlock, 112 MB used. If you get “current site is not a tenant administration site” here, you used the wrong URL; our tenant administration site fix covers it. GROUP#0 means a group-connected team site, as our site template guide explains.

Does Connect-SPOService Work in Windows PowerShell 5.1?

Yes. In Windows PowerShell 5.1.26100.9444, the MSI copy loaded automatically, and Get-Command found Connect-SPOService without any import:

"PowerShell $($PSVersionTable.PSVersion)"

Get-Module -ListAvailable -Name Microsoft.Online.SharePoint.PowerShell |
    Format-Table Version, ModuleBase -AutoSize

Get-Command Connect-SPOService | Format-Table Name, Source -AutoSize
Windows PowerShell 5.1 auto-loading the SharePoint Online Management Shell MSI module so Connect-SPOService works

Notice that 5.1 saw only the MSI copy. A Gallery install from PowerShell 7 went to Documents\PowerShell\Modules, a folder 5.1 doesn’t search, which is why one shell can work while the other can’t.

Connect-SPOService Not Recognized: Cause Cheat Sheet

What you findLikely causeFix
Get-Module -ListAvailable is emptyModule not installed for this shell or userInstall-Module ... -Scope CurrentUser
Module listed, Loaded: FalseNot imported in PowerShell 7Import-Module Microsoft.Online.SharePoint.PowerShell
Installed, still not listedFolder isn’t on PSModulePathCheck $env:PSModulePath, reinstall for this user
Works in one app, not anotherDifferent host or account (VS Code, scheduled task)Import the module in that host, or install it for that account
Import-Module shows a load errorConflict, such as the Client Components SDKUninstall the SDK, per Microsoft Learn

Common Mistakes to Avoid

  • Typos in the cmdlet. It’s Connect-SPOService, singular. Run Get-Command *SPOService* to see the exact names once the module loads.
  • Installing for one user, running as another. A CurrentUser install doesn’t follow a script into a service account’s scheduled task.
  • Using the site URL. Connect-SPOService wants https://<tenant>-admin.sharepoint.com, not your site address.

Next Steps

Once you’re connected, try a read-only script first, like the one we use to get SharePoint Online site details with PowerShell. Our SharePoint PowerShell commands cheat sheet lists the SPO cmdlets we reach for most.

We run these SPO scripts on our own tenant; they’re good next reads:

Frequently Asked Questions

Why is Connect-SPOService not recognized after I installed the module?

PowerShell 7 may not load it automatically. Run Import-Module Microsoft.Online.SharePoint.PowerShell, then check the result with Get-Command Connect-SPOService.

Which module contains Connect-SPOService?

Microsoft.Online.SharePoint.PowerShell, the SharePoint Online Management Shell. The Microsoft Learn getting-started guide covers both the MSI and the PowerShell Gallery install.

Do I need admin rights to install the SharePoint Online Management Shell?

No. Install-Module Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser installs it for your account only.

What URL do I use with Connect-SPOService?

Your SharePoint admin center URL, such as https://contoso-admin.sharepoint.com. The Connect-SPOService reference also lists certificate and managed identity sign-in.