Skip to content

Instantly share code, notes, and snippets.

@garrytrinder
Created January 23, 2019 14:57
Show Gist options
  • Save garrytrinder/6bb97a8298ab9163861b4b4b32295beb to your computer and use it in GitHub Desktop.
Save garrytrinder/6bb97a8298ab9163861b4b4b32295beb to your computer and use it in GitHub Desktop.
Azure Automation Runbook
Param(
[Parameter(Mandatory=$true)]
[string]$CredentialName,
[Parameter(Mandatory=$true)]
[string]$TenantAdminUrl,
[Parameter(Mandatory=$true)]
[string]$SiteTitle,
[Parameter(Mandatory=$true)]
[string]$SiteDescription,
[Parameter(Mandatory=$true)]
[string]$SiteUrl,
[Parameter(Mandatory=$true)]
[string]$SiteOwner,
[Parameter(Mandatory=$true)]
[int]$Lcid,
[Parameter(Mandatory=$true)]
[string]$TemplateId,
[Parameter(Mandatory=$true)]
[int]$TimeZoneId
)
$ErrorActionPreference = "Stop"
# create connection to SharePoint Admin site
$ConnectAdmin = Connect-PnPOnline -Url $TenantAdminUrl -Credentials (Get-AutomationPSCredential -Name $CredentialName)
# create Modern site with no Office 365 group
$NewSite = New-PnPTenantSite -Title $SiteTitle -Description $SiteDescription -Url $SiteUrl -Owner $SiteOwner -Lcid $Lcid -Template $TemplateId -TimeZone $TimeZoneId -Wait
# clean up SharePoint Admin connection
$DisconnectAdmin = Disconnect-PnPOnline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment