SharePoint Online scripting
To be able to connect to your tenant, you will use the Connect-SPOService
command.
The command takes the URL of the admin site of your tenant and the credentials for the session.
The admin URL is usually of the yourdomain-admin.sharepoint.com
form, but you can get the actual URL by going to the site through the Office 365 admin center:
The prompt is displayed when connecting to SharePoint Online. Not all the APIs support it, but SharePoint Online will prompt for credentials, allowing you to go through the MFS workflow if needed.
If you run the command without parameters, the credential prompt will be used.
Note
It is good practice to store credentials in a variable, as it is often reused when connecting to other APIs.
$credentials = Get-Credential Connect-SPOService ` -Url https://mytest321-admin.sharepoint.com ` -Credential $credentials
The Connect-SPOService
command will establish a connection that will live throughout the current PowerShell session or until the...