Connect to SharePoint Online PowerShell
Start to work with PowerShell with SharePoint Online.
Connect to SharePoint Online in Office 365 using Microsoft PowerShell on your Windows PC.
PowerShell gives you the possibility to manage SharePoint Online automated and programmatical way. SharePoint is one of the critical components of Microsoft 365. There are multiple complex features inside SharePoint Online like sites, Document libraries, or Microsoft List. PowerShell allows you to automate a lot of activities around these features.
Do the first step and learn how to connect to SharePoint Online PowerShell from Windows 10/11.
How to connect to SharePoint Online using PowerShell
Connecting to the SharePoint Online management shell using PowerShell is a great improvement in the area of automation and management. PowerShell could make your life much easier in the area of administering SharePoint Online.
Before you will connect to SharePoint in Office 365 remember to install the SharePoint PowerShell module first.
Install the SharePoint PowerShell module
In the first step remember to install the SharePoint Online PowerShell module on your Windows PC.
Connect to SharePoint Online PowerShell
SharePoint Online Management Shell will allow you to connect to SharePoint Online using PowerShell.
To connect to SharePoint PowerShell prepare your login and SharePoint admin site address:
Connect-SPOService -Url https://m365aw-admin.sharepoint.com -credential email@example.com
You will be asked for your password in the authentication window.
After pasting the password you will be connected to the PowerShell shell and start to work on SharePoint Online using cmdlets.
Connect to SharePoint Online PowerShell with MFA
If your account has Multi-Factor Authentication turned on, you can use SharePoint Online Management Shell and connect to SharePoint Online using PowerShell but you will need use different command.
To connect to SharePoint PowerShell with MFA prepare your SharePoint admin site address. You should not use -credential parameter.
Connect-SPOService -Url https://m365aw-admin.sharepoint.com
You will be asked to authenticate in the standard Microsoft 365 login window.
After you will paste your email address you should choose Work or school account.
In this case, after you will use your password you will need to authenticate using MFA.
After the authentication process with MFA, you will be connected to the PowerShell shell and start to work on SharePoint Online using cmdlets.
Connect to SharePoint PnP PowerShell
PnP PowerShell for SharePoint is a powerful toolset. Before you will be able to connect to SharePoint using PnP PowerShell install this module on your Windows PC.
To connect to SharePoint PnP PowerShell with MFA prepare your SharePoint admin site address.
Connect-PnPOnline -Url https://m365aw-admin.sharepoint.com
After the authentication process SharePoint PnP PowerShell will be connected and you can start to work on SharePoint Online using cmdlets.
Resolve problems with connecting to SharePoint Online PowerShell
Errors you can meet during the PowerShell connection to SharePoint Online:
- Connect-SPOService : The sign-in name or password does not match one in the Microsoft account system.
You did use not the correct password or you are trying to connect using an account with MFA and -credential parameter. Remove the -credential parameter and double-check your password.
- Connect-SPOService : Current site is not a tenant administration site.
You need to connect to the admin site. The address of the SharePoint admin site will be something like this: https://name-admin.sharepoint.com
Perfect! You have learned how to connect the SharePoint app using PowerShell in Windows. Now is the time to get a better understanding of Microsoft 365 apps. Learn how to use Power Automate flows, how to deploy and use Viva Connections and how to use OneDrive.
Learn how to connect to SharePoint Online using PowerShell in Windows 10/11. Use PowerShell Management Shell to automate the management of SharePoint Online.
- Admin (10)
- Blog (1)
- Exchange Online (7)
- Forms (2)
- Guest articles (1)
- Interviews (2)
- Licensing (26)
- Microsoft Bookings (1)
- Microsoft Lists (11)
- Microsoft Outlook (11)
- Microsoft Project (1)
- Microsoft Sway (1)
- Microsoft Teams (35)
- Microsoft Visio (1)
- Microsoft Viva (4)
- Office 365 (23)
- OneDrive (11)
- Planner (4)
- Podcasts (6)
- Power Apps (2)
- Power Automate (16)
- Power BI (1)
- Power Virtual Agents (2)
- Roadmap (9)
- Security & Compliance (3)
- SharePoint Online (71)
- Stream (1)
- To Do (2)
- Videos (34)
- Windows 365 (1)
- Yammer (6)