Troubleshoot Scripts

Troubleshoot Scripts

Azure Runbooks Logs

Azure runbooks have enhanced logs that help you troubleshoot issues with scripted actions.

To view the Azure runbook logs:

  1. Navigate to Scripted ActionsAzure runbooks.

  2. At the bottom of the window, in the Scripted Actions Tasks section, locate the task with an Error in the Status column.

  3. Select Details.

    The Job Details window displays.

  4. Locate the entry in the log with an error.

  5. In the Output section, select any of the following:

    • Show: Select Show to display the standard Azure automation account runbook output.

    • Exception: Select Exception to display the exception's details.

Troubleshoot Azure Runbooks

Troubleshooting Azure Runbooks

Problem

Solution

Description

In some cases, a script fails to perform the scripted action, but its status is incorrectly set to Complete. This means that the PowerShell script failed to encounter fatal errors. The final output from the script presents information about the script but has no indication of an error.

  1. Navigate to the associated Automation account.

  2. View the log with the time stamp that matches the Nerdio Manager task log.

  3. Find and resolve the error that is produced by the script in your Nerdio Manager.

When running an Azure scripted action, the associated Automation account runs a specialized runbook, which copies the code directly from the Nerdio Manager and executes it. All scripts are executed as instances of the same Automation Account job. Here you can find the errors generated when running your script. The errors vary based on your script.

Troubleshoot Windows Scripts

For information about troubleshooting Windows scripts refer to Custom Script Windows - Troubleshoot and Support.

For more information about troubleshooting the custom script extension (CSE or CSExtension) refer to Custom Script Windows - Troubleshoot and Support for Extensions.

Tip: It is recommended that you use an isolated development session host and run the scripts directly on the host to test your scripts. This ensures that the PowerShell code is functional and preforms as desired. In addition, it provides quicker results than running the commands through Nerdio Manager.

Troubleshooting Windows Scripts

Problem

Solution

Description

Scripts that cause reboots fail the entire process. When the extension is waiting for the PowerShell script to complete fully (and if a reboot is started), the script fails.

For actions which require restarts and then additional actions:

  1. Split the script up into multiple scripts.

  2. Select the "Individual with restart" script execution mode.

  3. Place the rest of the scripts in order.

N/A

Upgrade Azure Az PowerShell Module

Sometimes a scripted action or PowerShell script that works locally fails in with an error such as:

Method 'get_SerializationSettings' in type

'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient'

from assembly 'Microsoft.Azure.PowerShell.Clients.ResourceManager,

Version=1.0.0.0, Culture=neutral, PublicKeyToken=313kx3sd3c26ad364e35' does not have an implementation.

Sometimes the error message is different, or the error message suggests upgrading your Az modules. These errors can often be resolved by upgrading the Az module or modules used by the scripted action automation account.

To upgrade your Azure Az PowerShell module:

  1. Find the scripted actions automation account by selecting the Browse gallery button.

    Note: Do not use the Update Az Modules button because it does not actually update to the latest versions.

  2. Search for the relevant Az module, such as Az.KeyVault, and upgrade it.

    Note: This is determined by the specific command that is failing. For example, if the script fails on Get-AzKeyVault, then it is the Az.KeyVault module that needs to be updated.

  3. Sometimes the modules have dependencies on other Az modules, such as Az.Accounts. Dependencies may need to be updated as well.

Note: If you use a hybrid worker to execute scripted actions, then the modules need to be updated on the hybrid worker VM, rather than in the automation account. This can be accomplished using the Update-Module command on the hybrid worker VM.

Was this article helpful?

0 out of 0 found this helpful
Have more questions? Submit a request

Comments (0 comments)

Article is closed for comments.