An Azure service that is used to automate, configure, and install updates across hybrid environments.
Hello Tijmen, this is actually expected behaviour with the built-in PS 7.2 sandbox in Azure Automation. by default the sandbox strips out all the ANSI/colour info and only shows you a minimal “Error happened” summary in the main job view; the full error payload lives in the right-hand pane.
The root cause is that PowerShell 7 defaults $ErrorView toConciseView, which changes how ErrorRecord objects are serialized. The Azure Automation portal's error stream UI was built to parse the older NormalView format (used by PS 5.1), so it can't extract the "details" field from the new format — leaving the column blank.
Your $PSStyle.OutputRendering = 'PlainText' only strips ANSI escape sequences it doesn't change the ErrorRecord structure at all.
Add this at the very top of your runbook (alongside your existing ANSI cleanup):
# --- Fix empty error details in Azure Automation portal ---
$ErrorView = 'NormalView'
$ErrorActionPreference = 'Continue'
# Your existing ANSI cleanup (keep this too)
if ($PSVersionTable.PSVersion.Major -ge 7 -and $null -ne $PSStyle) {
$PSStyle.OutputRendering = 'PlainText'
}
Setting $ErrorView = 'NormalView' forces PS7 to format errors the way PS 5.1 did, which the Automation portal can parse and display in the details column.
You can try Convert ErrorRecords to Strings: In some cases, even NormalView doesn't fully populate the details column because Azure Automation's serialization of the ErrorRecord object itself is the issue. The nuclear option is to catch errors and re-emit them as plain strings:
$ErrorView = 'NormalView'
try {
# Your code here
Get-Something -ErrorAction Stop
}
catch {
# Convert the full ErrorRecord to a string so the portal can display it
$errorMessage = $_.Exception.Message
$errorPosition = $_.InvocationInfo.PositionMessage
$fullError = "$errorMessage`n$errorPosition"
Write-Error -Message $fullError
# Or if you want it in the Output stream (always visible):
# Write-Output "ERROR: $fullError"
}
This ensures the portal gets a plain string in the error stream rather than a complex ErrorRecord object it can't properly deserialize.
Consider Upgrading to PowerShell 7.4 Runtime: Microsoft has deprecated PS 7.1 and 7.2 runtimes for Azure Automation. The recommendation is to move to the PowerShell 7.4 runtime (available via the Runtime Environments experience), which may have improved error stream handling.
To upgrade:
- Automation Account > Runtime Environments > Create a new PS 7.4 runtime
- Update your runbook to use the new runtime
- Test in the Test pane before publishing
https://learn.microsoft.com/en-us/azure/automation/automation-runbook-types?tabs=lps74%2Cpy10
Hope this helps. If the information was useful, please consider accepting the answer and upvoting. Feel free to reach out if you need any further assistance. Thank you.