Omar El-Anis – 365 Developer

My experiences with SharePoint, Flows, PowerApps, JavaScript and all of the other lovely web technologies out there!

SharePoint Services SharePoint Useful Tricks Uncategorised

Create Modern Portal SharePoint site in SharePoint Online using powershell

Use the script below to create a new Modern Portal site within SharePoint Online using c# PowerShell

<p># Connect to SharePoint Online<br>
# This command will prompt the sign-in UI to authenticate<br>
Connect-PnPOnline "" –Credentials (Get-Credential)</p>
<p># Create the new "modern" team site<br>
$teamSiteUrl = New-PnPSite -Type TeamSite -Title "TITLE FOR THE SITE" -Alias "My site alias" -Description "site for storing and managing all collaboration" -Url<br>
# Connect to the modern site using PnP PowerShell SP cmdlets<br>
# Since we are connecting now to SP side, credentials will be asked<br>
Connect-PnPOnline $teamSiteUrl</p>
<p># Now we have access on the SharePoint site for any operations<br>
$context = Get-PnPContext<br>
$web = Get-PnPWeb<br>
$context.Load($web, $web.WebTemplate)<br>
$web.WebTemplate + "#" + $web.Configuration</p>

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments