Advertisement

Responsive Advertisement

Connect SharePoint OnlineSite and create site using PnP PowerShell-O365

 In this article, we will see how to connect SharePoint  Site  and Create site using PnP PowerShell.Before you begin utilizing PowerShell to oversee SharePoint Online, ensure that the SharePoint Online Management Shell is installed. 

You can install the SharePoint Online Management Shell by downloading and running the SharePoint Online Management Shell.You only need to do this once for each computer from which you are running SharePoint Online PowerShell commands.

Before connecting to the SharePoint site, we need to get Credentials by using the Get-Credential cmdlet which creates a credential object for a specified username and password.
You can use the credential object in security operations. By default, an authentication dialog box appears to prompt the user like the below example picture.


#SPO Sample

$cred = Get-Credential -UserName '@.onmicrosoft.com' -Message "Enter SPO credentials"



#Connect to SPO

Connect-SPOService -Url 'https://-admin.sharepoint.com' -Credential $cred



#Create new site collection

New-SPOSite -Url 'https://.sharepoint.com/sites/demo' -Title 'Tech Talk Demo' -Template 'STS#0' -Owner @.onmicrosoft.com -NoWait -StorageQuota 1000 -ResourceQuota 75 

Thus, you have learned how to connect and create SharePoint lists  programmatically using PnP PowerShell commands.

PnP PowerShell is supported by SharePoint Online. The operations mentioned above, are tested on SharePoint Online environments.

Post a Comment

0 Comments