Runbook authoring and execution
Azure Automation allows the creation of automation scripts known as runbooks. Multiple runbooks can be created using the Azure portal or PowerShell ISE. They can also be imported from Runbook Gallery. The gallery can be searched for specific functionality, and the entire code is displayed within the runbook.
A runbook can accept parameter values just like a normal PowerShell script. The next example takes a single parameter named connectionName
of type string
. It is mandatory to supply a value for this parameter when executing this runbook:
param( [parameter(mandatory=$true)] [string] $connectionName ) $connection = Get-AutomationConnection -name $connectionName $subscriptionid = $connection.subscriptionid $tenantid = $connection.tenantid $applicationid = $connection.applicationid $cretThumbprint = $connection.CertificateThumbprint...