Connecting PowerShell to SharePoint Online


So you have configured your environment to have PowerShell connect to Office 365 using my previous blog post:

Configuring PowerShell access in Office 365

However, this only used to provide access to tenant and Exchange administration. With the Wave 15 release of Office 365 you can now also connect to SharePoint Online. here is how to do just that.

You are going to need a machine that has the Windows Management Framework 3.0 installed, which basically means you need PowerShell version 3.0. if you are keeping up with the times and running Windows 8 as your desktop then you already have PowerShell 3.

Next you’ll to install the SharePoint Online Management Shell. The latest one I found is here:

I also found an earlier preview following some links but I’d suggest the latest version is what you want.

So on the Windows 8 machine on which you have the Microsoft Online Services Module for Windows PowerShell installed ,run it as an administrator and accept the UAC.


The next step is to load in the SharePoint Online cmdlets for use in this session. after some digging around I found that they are called:



So at the prompt type:


that should result in the above warning.


Now you will need to log into your Wave 15 account. i normally do this by saving the login details to a variable by typing the following:


A dialog windows as shown above will appear into which you need to enter the login and password of a suitably enabled Office 365 user who can administer SharePoint Online. If in doubt use the initial global administrator that was provisioned with your site.


The next step is now to use those credential to connect to SharePoint Online. To do this execute the following line:

connect-sposervice –url –credential $cred

in my case this was:

connect-sposervice –url –credential $cred


In true PowerShell form, if everything is correct you will simply be returned to a prompt. Now you can execute commands against SharePoint Online. For example the following will display all your SharePoint Online sites by URL in a table:

get-sposite | ft “url”

Now you can start exploring all the cmdlets that are available for SharePoint Online which you can find at the bottom of this page:

Does the same process work on Wave 14 tenants that haven’t yet been upgraded to Wave 15 and SharePoint 2013?


I tried it on my Wave 14 tenant ( above and it worked! Excellent, roll on SharePoint Online control via PowerShell everywhere.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s