2

I my ARM template I am trying to convert a string array of IP addresses in to an array that holds an object.

The ARM template should eventually look like this:

"ipRules": [
        {
          "value": "1.1.1.1",
          "action": "Allow"
        },
        {
          "value": "1.1.1.2",
          "action": "Allow"
        },
      ]

So to get an object notation like above, I tried to make a new variable using the Copy function to iterate the original Ip array:

"convertedAllowedIps": {
  "copy": [
    {
        "count": 2,
        "input": {
            "value": "[variables('allowedIps')[copyIndex()]]",
            "action": "Allow"
        }
    }
  ]
}

I assigned it like this:

"ipRules": "[variables('convertedAllowedIps')]",

This leads to an 'The language expression property could not be evaluated' error. What am I doing wrong here?

1 Answer 1

2

copy function looks like this:

"convertedAllowedIps": {
  "copy": [
      {
        "name": "something",
        "count": 2,
        "input": {
          "value": "[variables('allowedIps')[copyIndex('something')]]",
          "action": "Allow"
      }
    }
  ]  
}

and then you would reference it like this:

"[variables('convertedAllowedIps').something]"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.