Templates/RouteTable.json

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "routeTableName": {
      "type": "string",
      "defaultValue": "routeTable%UID%",
      "metadata": {
        "description": "The RouteTable name."
      }
    },
    "routeTableLocation": {
      "type": "string",
      "defaultValue": "%LOCATION%",
      "metadata": {
        "description": "RouteTable Location."
      }
    },
    "routeTableRoutes": {
      "type": "array",
      "defaultValue": [
        {
          "name": "internet-route",
          "addressPrefix": "0.0.0.0/0",
          "nextHopType": "Internet"
        }
      ],
      "metadata": {
        "description": "An array that will be translated into routes."
      }
    },
    "routeTableTags": {
      "type": "object",
      "defaultValue": {
        "Date": "%DATE%"
      },
      "metadata": {
        "description": "Route Table Tags."
      }
    }
  },
  "variables": {
    "routeTableLocation": "[if(empty(parameters('routeTableLocation')), resourceGroup().location, parameters('routeTableLocation'))]",
    "tableProperties": {
      "copy": [
        {
          "name": "routes",
          "count": "[length(parameters('routeTableRoutes'))]",
          "input": {
            "name": "[parameters('routeTableRoutes')[copyIndex('routes')].name]",
            "properties": {
              "addressPrefix": "[parameters('routeTableRoutes')[copyIndex('routes')].addressPrefix]",
              "nextHopType": "[parameters('routeTableRoutes')[copyIndex('routes')].nextHopType]"
            }
          }
        }
      ]
    }
  },
  "resources": [
    {
      "apiVersion": "2017-10-01",
      "type": "Microsoft.Network/routeTables",
      "name": "[parameters('routeTableName')]",
      "location": "[variables('routeTableLocation')]",
      "tags": "[parameters('routeTableTags')]",
      "properties": "[variables('tableProperties')]"
    }
  ],
  "outputs": {}
}