Next up, let's talk about how to connect
to SharePoint Online with PowerShell. How
do we get the module? The SharePoint
Online PowerShell module is hosted on the
PowerShell Gallery. The PowerShell Gallery
is the central repository for PowerShell
content from Microsoft, as well as from
the community. To download modules from
the PowerShell Gallery, you need to have
PowerShellGet. You might already have
PowerShellGet and I think most of you
probably already have PowerShellGet,
because it's included with Windows 10 or
newer, Windows Server 2016 or newer
operating systems, if you have the Windows
Management Framework 5.0 or newer, or if
you have PowerShell 6. If you have an
older version of Windows or PowerShell,
just download the PackageManagement MSI
from the Download link in the slides or
simply search Package Management MSI in
your favorite search engine. After you
have the requirement, you simply need to
run the Install-Module cmdlet and specify
the name of the module, which is
Microsoft.Online .SharePoint .PowerShell.
It will ask you to confirm a few things,
and then it will download everything for
you. In order to connect, you need to be a
SharePoint Online administrator, and you
need to know the url of the SharePoint
Online admin center, which is always in
the form of https://tenant name -
admin.sharepoint .com. You need to open up
the SharePoint Online management shell or
a normal partial window and import the
SharePoint Online module, then get the
credential and save it in a variable, and
finally establish a connection using the
Connect-SPOService cmdlet, specifying the
URL of the SharePoint Online admin center,
and you can view in this case the URL of
my SharePoint Online admin center is
globamanticsorg- admin.sharepoint .com and
then give it the credential. If you are
using multi-factor authentication, you
need to run the Connect-SPOService partial
cmdlet and you would not give it a
credential; you're simply going to have a
web login or pop-up window opening up,
which we're going to be able to enter your
username, password, and then it will ask
you for your second method of authentication.