Get started
1. Download and open the SharePoint Online Management Shell
Link: https://www.microsoft.com/en-us/download/details.aspx?id=35588
Open the shell (run as administrator)
2. Proxy authentication (Optional)
1 2 |
$cred = [System.Net.CredentialCache]::DefaultCredentials [System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred |
3. Connect to your SharePoint Online
Simple:
1 |
Connect-SPOService -Url "https://<mydomain>-admin.sharepoint.com" -Credential "<myname>@<mydomain>.com" |
It will ask you for password.
Complete:
For more information: https://technet.microsoft.com/en-us/library/fp161372.aspx
1 2 3 4 |
$adminUPN="<the full email address of a SharePoint Online global administrator account, example: jdoe@contosotoycompany.onmicrosoft.com>" $orgName="<name of your Office 365 organization, example: contosotoycompany>" $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password." Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential |
Issues
Import Module issue
Run SharePoint Online Management Shell in administrator mode should resolve the error.
Connecting Issue
When I first attempted to connect to SharePoint Online with the “Connect-SPOService” command, I got the error “Connect-SPOService : Could not connect to SharePoint Online”.
The reason for that is, when you try to administer SharePoint Online (O365) via PowerShell through a proxy server the Connect-SPOService cmdlet connections fail.
To solve the problem parse the cached credentials to the proxy.
1 2 |
$cred = [System.Net.CredentialCache]::DefaultCredentials [System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred |
Development
Back to the days when I started to mess around with SharePoint online (in early 2015), only 41 SharePoint Online commands were available.
Compared to 782 on premise SharePoint 2013 commands, SPO shell was very restricted.
Two years have passed – Microsoft has added 25 extra SPO cmdlets.
And here are the new cmdlets in case you are curious.
SharePoint Online Powershell is still far from the on premise version but you can still do several things with it such as managing users, site and customizing.
For more information about SPO Shell I recommend this blogs:
General information and how it technically works: https://en.share-gate.com/blog/sharepoint-online-management-shell
Customizing examples: http://chen.about-powershell.com/
Sources:
Download SPO Management Shell: https://www.microsoft.com/en-us/download/details.aspx?id=35588
Connect to SharePoint Online PowerShell – https://technet.microsoft.com/en-us/library/fp161372.aspx
Connect-SPOService : Could not connect to SharePoint Online – https://sharepoint.stackexchange.com/questions/154484/connect-sposervice-could-not-connect-to-sharepoint-online
Thank you, especially for the get started and issues, good job!