Use the script below to create a new Modern Portal site within SharePoint Online using c# PowerShell
[csharp]</p> <p># Connect to SharePoint Online<br> # This command will prompt the sign-in UI to authenticate<br> Connect-PnPOnline "https://tenant.sharepoint.com/" –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 https://tenant.sharepoint.com/sites/MYSITEURL<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> Execute-PnPQuery<br> $web.WebTemplate + "#" + $web.Configuration</p> <p>[/csharp]