Last active
December 15, 2018 21:15
-
-
Save garrytrinder/f30cc56cc6ff6cf1ae454c7fa3b3e116 to your computer and use it in GitHub Desktop.
Azure Automation PnP New Site Runbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 Tenant Site | |
$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