Skip to content

Instantly share code, notes, and snippets.

@garrytrinder
Last active December 15, 2018 21:15
Show Gist options
  • Save garrytrinder/6606cfd9b74da5cb0f413be75ebc177d to your computer and use it in GitHub Desktop.
Save garrytrinder/6606cfd9b74da5cb0f413be75ebc177d to your computer and use it in GitHub Desktop.
Azure Automation Basic PnP Provisioning Runbook
Param(
[Parameter(Mandatory=$true)]
[string]$CredentialName,
[Parameter(Mandatory=$true)]
[string]$SiteUrl,
[Parameter(Mandatory=$true)]
[xml]$Template
)
# Store XML Template as local file
$Template.save("$home\template.xml")
# Create connection to SharePoint site
$Connect = Connect-PnPOnline -Url $SiteUrl -Credentials (Get-AutomationPSCredential -Name $CredentialName)
# Apply PnP Provisioning Template
$ApplyPnPProvisioningTemplate = Apply-PnPProvisioningTemplate -Path "$home\template.xml" -Wait
# Clean up SharePoint connection
$Disconnect = Disconnect-PnPOnline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment