An Azure service that is used to automate, configure, and install updates across hybrid environments.
Hello Frank Muraschow,
Thank you for reaching out to the Microsoft Q&A forum.
This odd conversion is actually coming from PowerShell’s literal‐to‐number rules rather than Azure Automation itself. If you pass “00066” as a true string (e.g. in the Azure portal) it stays “00066,” but when Power Automate kicks off your runbook it’s serializing the parameter as a JSON number—PowerShell then sees a leading zero and treats it as an octal literal (066₈ → 54₁₀).
Here’s what you can do:
Force Power Automate to send it as a JSON string
If you’re using the HTTP/Webhook action, make sure your body is something like { "MyInput": "00066" } (i.e. include the quotes around 00066).
If you’re using the Azure Automation connector, wrap the value in a Compose or Convert to string action so the parameter is sent as text, not number.
Explicitly convert inside your runbook If for some reason you can’t change the PA side, you can defensively re-cast in PowerShell:
param(
[Parameter(Mandatory=$true)][string]$MyInput
)
# This wipes out any implicit numeric conversion
$MyInput = [string]$MyInput
Write-Output "[Input] MyInput: $MyInput"
Keep your “X” workaround Prefixing with a non-numeric character (like “X00066”) will always force string parsing, then strip it off as you’ve been doing.
Hope that clears it up!
Reference links
• PowerShell string→number conversion rules (leading zero = octal): https://learn.microsoft.com/powershell/scripting/lang-spec/chapter-06?view=powershell-7.5#616-conversion-from-string-to-numeric-type
• How JSON numbers get parsed in PowerShell/webhooks: send values as JSON strings to preserve leading zeros