Dynamically add natRuleCollections for Azure Firewall using ARM template

Viewed 111

When creating an Azure Firewall, I would like to dynamically add the natRuleCollections using a parameter:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "natRules": {
      "value": [
        {
          "name": "sql01",
          "priority": 501,
          "rules": [
            {
              "port": "1433",
              "protocols": [
                "TCP",
                "UDP"
              ],
              "translatedAddress": "10.1.1.1",
              "sourceAddresses": [
                "*"
              ]
            }
          ]
        },
        {
          "name": "other01",
          "priority": 502,
          "rules": [
            {
              "port": "1234",
              "protocols": [
                "TCP",
                "UDP"
              ],
              "translatedAddress": "10.1.1.2",
              "sourceAddresses": [
                "1.2.3.4",
                "5.6.7.8"
              ]
            },
            {
              "port": "5678",
              "protocols": [
                "TCP",
                "UDP"
              ],
              "translatedAddress": "10.1.1.2",
              "sourceAddresses": [
                "9.10.11.12",
                "13.14.15.16"
              ]
            }
          ]
        }
      ]
    }
  }
}

There are examples of creating the firewall with and ARM template, but they are simplified and do not have arrays with real-life scenario's (like re-using created public IP addresses). I can use the copy functionality, but that will only give me the first level, not the nested rules.

How can I achieve this scenario with ARM templates?

0 Answers
Related