We have now learned how to connect to
SharePoint Online using the Microsoft
provided modules, but I also want to teach
you how to connect to Office 365 using the
Office 365 Dev PnP PowerShell cmdlets,
which you might not know about since it's
not an official Microsoft module. So let's
first find out what they are. The Office
365 Dev PnP, which stands for Patterns and
Practices is an open source initiative by
the SharePoint engineering group at
Microsoft, which contains multiple
solutions, best practices, and code
samples on how to do more with Office 365
and SharePoint. One of the awesome
solutions is the SharePoint and Office 365
Dev PnP PowerShell Cmdlets, which include
over 400 PowerShell cmdlets that allow you
to do a lot more than what you can do with
the Microsoft provided SharePoint Online
PowerShell module. How do we get it? Well,
the PnP PowerShell module is hosted on the
PowerShell Gallery as well so the same
thing as the SharePoint Online module, and
the same prerequisites as the SharePoint
Online module as well. In order to install
it, we're going to run the Install-Module
PowerShell cmdlet and then specified the
name of the cmdlet, which is
SharePointPnPPowerShellOnline. To connect,
you need to be a SharePoint Online admin
in order to manage things at the tenant
level, like for example create a new site
collection or play with hub sites and
things like that. You can also simply be a
site collection administrator if you only
want to manage only a single site
collection, and lastly, you'll need the
URL of the site collection you want to
manage or the URL of the SharePoint Online
admin center if you want to manage tenant
level settings. To connect, you simply get
the credential and then run the
Connect-PnPOnline PowerShell cmdlet
specifying the URL of the site you want to
connect to. So remember the tenant admin
site or the SharePoint Online admin center
URL, if you want to manage something
across the tenant or create a new site
collection and things like that, or the
URL of the site collection that you want
to manage specifically, and then give it
your credential object. If you want to
connect to SharePoint Online using the PnP
module with multifactor authentication, it
would still be the Connect-PnPOnline
partial cmdlet, but we wouldn't be able to
save that credential object so we're going
to give it the -UseWebLogin switch
parameter, which will open the pop-up
required so we can enter our username and
password, as well as second authentication method.