Search code examples
jsonazure-powershellazure-automationazure-runbook

Azure Automation Runbook input IP Addresses as String array parameter


I'm not sure how I'm supposed to input a list of IP addresses as a string array in Azure Automation. I get "invalid JSON primitive: 10.10.3.0" when I used JSON format

['10.10.3.0/24', '10.10.4.0/24']

Am I supposed to escape the forward slash?

[string] $backendAddressPoolName  = "backendPool",
[string[]] $backendIPAddresses,

That's it. These are the parameters to my runbook. Azure Automation won't accept

["10.10.3.0/24", "10.10.4.0/24"]

As an input for backendIPAddresses


Solution

  • param(
        [string[]]$backendIPAddresses
    )
    
    $backendipaddresses | % { "input: $_" }
    

    Input this exactly: ["str1","str2"] - this has to be valid json

    enter image description here

    json validator: https://jsonlint.com/