Thursday 24 April 2014

Connect-SPO using powershell

SPO Powershell commands
Go to run...(Windows + R)
Type:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Click Ok
Type below command, you will get prompt to enter password.
Connect-SPOService -Url https://contoso-admin.sharepoint.com -Credential spo@microsoft.com
Or
function Connect-SPOSite() {
param (
$user = "spo@microsoft.com",
$site = "https://contoso-admin.sharepoint.com"
)
if ((Get-Module Microsoft.Online.SharePoint.PowerShell).Count -eq 0) {
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
}
$cred = Get-Credential $user
Connect-SPOService -Url $site -Credential $cred
}
Connect-SPOSite
Now you have connected to SPO site..
Now Execute commands....
Get-SPOUser -Site https://contoso-admin.sharepoint.com