Last active
December 15, 2018 17:55
-
-
Save garrytrinder/8e54b596f33d312a4502a32a11a55463 to your computer and use it in GitHub Desktop.
Example of a very basic Azure Automation Runbook that outputs a JSON object
This file contains hidden or 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]$SiteUrl | |
) | |
# ensure that any error stops the job | |
$ErrorActionPreference = "Stop" | |
# create connection to SharePoint site | |
Connect-PnPOnline -Url $SiteUrl -Credentials (Get-AutomationPSCredential -Name "Lundhill") | |
# get web | |
$web = Get-PnPWeb | |
# output json | |
Write-Output @{WebTitle=$web.Title} | ConvertTo-Json | |
# clean up SharePoint connection | |
Disconnect-PnPOnline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment