How can connect to SharePoint online to run some PowerShell commands? It would be nice if someone has drilled down the steps for me :)

4 Answers 4


Connecting to SharePoint Online

Before you connect to SharePoint Online, you’ll need to have the username and password for an account with global administrator permissions. You’ll also need to know your tenant admin URL (i.e.: https://mytenant-admin.sharepoint.com). When connecting to SharePoint Online, don’t forget to reference all URLs securely using https.If you try and use http, you will get an error. To connect to SharePoint Online, use the Connect-SPOService command. It takes the URL to your tenant admin and a username. When you connect, you’ll be prompted for your password.

Connect-SPOService –Url https://mytenant-admin.sharepoint.com –Credential [email protected]

SPO Management Shell

If you connect successfully, you will be returned to the command prompt without error. To see what commands are available, we can use Get-Command and pass it the module Microsoft.Online.SharePoint.PowerShell.dll

Source: https://web.archive.org/web/20190301143657/http://dotnet.sys-con.com/node/2465770

  • Do we really need to be a global admin for everything? Say just reading and creating folders on a site where the user has full-control? Do we still need to be global admin?
    – Nick N.
    Commented Jan 29, 2018 at 12:41
  • Please check out some other methods described here that will also save you some extra time: github.com/SharePoint/PnP-PowerShell/wiki/…
    – Alberto S.
    Commented Feb 26, 2019 at 11:04
  • 1
    @NickN. You don't need to be an Office 365 Global Admin to use PowerShell with SPO, you just need to be a SharePoint Online Admin. Microsoft recommends only one person in an organization be a Global Admin because of the reaching access that permission level has. See more info here: docs.microsoft.com/en-us/powershell/sharepoint/…
    – TylerH
    Commented Feb 26, 2019 at 15:11

Please refer to these two links from MSDN; they show everything you need to know about SharePoint Online and PowerShell.


and to your issue of how to setup PowerShell for SharePoint Online:

  1. Install Windows PowerShell 3.0 from Windows Management Framework 3.0.

  2. Install the SharePoint Online Management Shell from the Microsoft Download Center.

  3. Click Start>All Programs>SharePoint Online Management Shell.

  4. Run Connect-SPOService. For example, Connect-SPOService -Url https://contoso-admin.sharepoint.com -credential [email protected], where:
    • Url is the URL of the SharePoint Online Administration Center.

    • Credential is the user name to which you want to grant access to the SharePoint Online Administration Center site.

  5. Try it out! For example, run Get-SPOSite to get a list of all sites.



Maybe a bit late but you can use the project Client-Side SharePoint Powershell http://sharepointpowershell.codeplex.com/ as a PowerShell API to SharePoint Online. The features still need to grow, but you can extend it yourself pretty easy and otherwise just request some features.

  1. You need to install PowerShell depending on the bitness of your windows.
  2. Install Microsoft Online Services Sign-In Assistant for IT Professionals
  3. install Windows Azure Active Directory Module for Windows PowerShell

and test it.

Reference & for more details: https://ziaahmedshaikh.wordpress.com/2015/09/11/configure-windows-powershell-to-connect-with-o356/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.