Considerations for Scripted Actions
Considerations for Window Scripted Actions
For information about Windows scripted actions considerations refer to Custom Script Windows - Tips and Tricks.
Custom script extensions have a 90-minute timeout set by Azure. The script fails after 90 minutes if:
It is stuck.
It waited too long for user input.
It did not complete on time.
The script is run with administrative privileges and does not interrupt other sessions. Most scripts are safe to run while users are on the VM.
Note: For information about troubleshooting Windows scripts refer to Troubleshoot Scripts.
Considerations for Azure Scripted Actions
Some general conventions and common procedures used for runbooks are not applicable in Nerdio Manager.
These key considerations are important:
There is no need to specify authentication, such as authenticating using the RunAs account or passing a credential. By the time the actual code in the scripted action is executed, Nerdio Manager is already logged in to Azure, and no additional authentication is required.
Note: In this case, the Nerdio Manager service principal needs the appropriate permissions on resources it attempts to alter.
Azure Modules are already installed in the Azure Automation Account. If you require a specific version, change the modules attached to the automation account. Any other modules that are needed require additional installation.
Some Variables are defined prior to your code. This is useful to get the necessary parameters. For example, the VM name, the subscription the VM is in, etc. To view the variables, hover over the Info icon next to Script.
Note: Nerdio provides several pre-populated variables that can be used in the script code. The available variables are:
$HostPoolId (Available when the script is associated with a host pool)
$HostPoolName (Available when the script is associated with a host pool)
$AzureVMName (Available when the script is associated with a VM)
$ADUsername (if passing AD credentials)
$ADPassword (if passing AD credentials)
$DesktopUser (Available when the script is associated with a personal host pool)
It is advisable to use the Write-Output command throughout the script to provide information about what the script is doing and how far the script has progressed. The output appears in Nerdio Manager. Output from Write-Error also appears, but the output from Write-Verbose does not.
Have commands that result in an error exit out of the script entirely. In that case, the Run job results in "Fail" instead of "Complete", which is relayed to Nerdio Manager.
Note: For information about troubleshooting Azure runbooks refer to Troubleshoot Scripts.