This post shows you one of options to provision a SharePoint Team Site using PowerShell. You have few option at this link https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/modern-experience-customizations-provisioning-sites somehow the C# code does not work for me. The code snippet below works for me.
The classification was giving me error so we have gone without it.
# Connect to SharePoint Online
# This command will prompt the sign-in UI to authenticate
# Create the new “modern” team site
$teamSiteUrl=New-PnPSite -Type TeamSite -Title “IT Team Site”
-Alias “itteamsite” -Description “IT Team Site” -IsPublic
# Connect to the modern site using PnP PowerShell SP cmdlets
# Since we are connecting now to SP side, credentials will be asked
# Now we have access on the SharePoint site for any operations
$context = Get-PnPContext
$web = Get-PnPWeb
$web.WebTemplate + “#” + $web.Configuration
You need to install PnP-PowerShell, https://github.com/SharePoint/PnP-PowerShell/releases, to avoid the “connect-pnponline is not recognized” error.