Param
(
[Parameter (Mandatory= $true)]
[string] $siteUrl,
[Parameter (Mandatory= $true)]
[string] $DocLibName
)
#Connect to SPO
$tenantName= "client"
$username = "[email protected]"
$password = "hashing!" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$Password
#create view
$ViewName= "Grouped by Team"
$ViewFields = @("DocIcon","LinkFilename","Team", "Modified", "Modified_x0020_By")
$ViewQuery = "<GroupBy Collapse=""TRUE""><FieldRef Name=""Team"" Ascending=""True""/></GroupBy> <OrderBy><FieldRef Name=""LinkFilename"" /></OrderBy>"
#provide view
Connect-PnPOnline -Url $siteUrl -Credentials $cred
Add-PnPView -List $DocLibName -Title $ViewName -Fields $ViewFields -Query $ViewQuery
I'm running this Runbooks/PowerShell script. Somehow this script always runs 3 times in Azure with an exception:
The runbook job was attempted 3 times, but it failed each time. Common reasons that runbook jobs fail can be found here: https://docs.microsoft.com/en-us/azure/automation/automation-troubleshooting-automation-errors
The script works like a charm on my local PowerShell and PowerShell ISE...
Any runbooks hero in the house?