<commit_before>﻿{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "dnsName": {
            "type": "string",
            "metadata": {
                "description": "Connect to your cluster using dnsName.location.cloudapp.azure.com"
            }
        },
        "vmUserName": {
            "type": "string",
            "metadata": {
                "description": "user name to ssh to the VMs"
            }
        },
        "vmPassword": {
            "type": "securestring",
            "metadata": {
                "description": "password to ssh to the VMs"
            }
        },
        "mysqlRootPassword": {
            "type": "securestring",
            "metadata": {
                "description": "mysql root user password single quote not allowed"
            }
        },
        "mysqlReplicationPassword": {
            "type": "securestring",
            "metadata": {
                "description": "mysql replication user password single quote not allowed"
            }
        },
        "mysqlProbePassword": {
            "type": "securestring",
            "metadata": {
                "description": "mysql probe password single quote not allowed"
            }
        },
        "vmSize": {
            "type": "string",
            "defaultValue": "Standard_D2",
            "metadata": {
                "description": "size for the VMs"
            }
        },
        "storageAccountType": {
            "type": "string",
            "defaultValue": "Standard_LRS",
            "metadata": {
                "description": "Storage account type for the cluster"
            }
        },
        "virtualNetworkName": {
            "type": "string",
            "defaultValue": "mysqlvnet",
            "metadata": {
                "description": "Virtual network name for the cluster"
            }
        },
        "vnetNewOrExisting": {
            "type": "string",
            "defaultValue": "new",
            "allowedValues": [
                "new",
                "existing"
            ],
            "metadata": {
                "description": "Identifies whether to use new or existing Virtual Network"
            }
        },
        "virtualNetworkExistingRGName": {
            "type": "string",
            "defaultValue": "",
            "metadata": {
                "description": "If using existing VNet, specifies the resource group for the existing VNet"
            }
        },
        "dbSubnetName": {
            "type": "string",
            "defaultValue": "dbsubnet",
            "metadata": {
                "description": "subnet name for the MySQL nodes"
            }
        },
        "vnetAddressPrefix": {
            "type": "string",
            "defaultValue": "10.0.0.0/16",
            "metadata": {
                "description": "IP address in CIDR for virtual network"
            }
        },
        "dbSubnetAddressPrefix": {
            "type": "string",
            "defaultValue": "10.0.1.0/24",
            "metadata": {
                "description": "IP address in CIDR for db subnet"
            }
        },
        "dbSubnetStartAddress": {
            "type": "string",
            "defaultValue": "10.0.1.4",
            "metadata": {
                "description": "Start IP address in the subnet for the VMs"
            }
        },
        "imagePublisher": {
            "type": "string",
            "defaultValue": "OpenLogic",
            "allowedValues": [
                "OpenLogic"
            ],
            "metadata": {
                "description": "publisher for the VM OS image"
            }
        },
        "imageOffer": {
            "type": "string",
            "defaultValue": "CentOS",
            "allowedValues": [
                "CentOS"
            ],
            "metadata": {
                "description": "VM OS name"
            }
        },
        "imageSKU": {
            "type": "string",
            "defaultValue": "6.6",
            "allowedValues": [
                "6.5",
                "6.6"
            ],
            "metadata": {
                "description": "VM OS version"
            }
        },
        "mysqlFrontEndPort0": {
            "type": "int",
            "defaultValue": 3306,
            "metadata": {
                "description": "MySQL public port master"
            }
        },
        "mysqlFrontEndPort1": {
            "type": "int",
            "defaultValue": 3307,
            "metadata": {
                "description": "MySQL public port slave"
            }
        },
        "sshNatRuleFrontEndPort0": {
            "type": "int",
            "defaultValue": 64001,
            "metadata": {
                "description": "public ssh port for VM1"
            }
        },
        "sshNatRuleFrontEndPort1": {
            "type": "int",
            "defaultValue": 64002,
            "metadata": {
                "description": "public ssh port for VM2"
            }
        },
        "mysqlProbePort0": {
            "type": "int",
            "defaultValue": 9200,
            "metadata": {
                "description": "MySQL public port master"
            }
        },
        "mysqlProbePort1": {
            "type": "int",
            "defaultValue": 9201,
            "metadata": {
                "description": "MySQL public port slave"
            }
        },
        "artifactsPath": {
            "type": "string",
            "defaultValue": "https://raw.githubusercontent.com/jarobey/azure-quickstart-templates/master/mysql-replication",
            "metadata": {
                "description": "template and script file location",
                "artifactsBaseUrl": "Base URL of the Publisher Template gallery package"
            }
        },
        "customScriptCommandToExecute": {
            "type": "string",
            "defaultValue": "bash azuremysql.sh",
            "metadata": {
                "description": "bash script command line"
            }
        },
        "dblbIP": {
            "type": "string",
            "defaultValue": "10.0.1.6",
            "metadata": {
                "description": "private IP address for MySQL loadbalancer"
            }
        }
    },
  "variables": {
    "templateAPIVersion": "2015-01-01",
    "resourceAPIVersion": "2015-06-15",
    "storageAccountName": "[concat(uniquestring(resourceGroup().id),'storage')]",
    "nodeCount": 2,
    "lbName": "[concat(parameters('dnsName'), '-lb')]",
    "lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]",
    "ilbBackendAddressPoolName": "[concat(parameters('dnsName'), '-ilbBackendPool')]",
    "ilbBackendAddressPoolID": "[concat(variables('lbID'),'/backendAddressPools/', variables('ilbBackendAddressPoolName'))]",
    "ilbRuleName": "[concat(parameters('dnsName'), '-ilbRule')]",
    "ilbRuleID": "[concat(variables('lbID'),'/loadBalancingRules/',variables('ilbRuleName'))]",
    "sshIPConfigName": "[concat(parameters('dnsName'), '-sshIPCfg')]",
    "sshIPConfig": "[concat(variables('lbID'),'/frontendIPConfigurations/',variables('sshIPConfigName'))]",
    "nicName": "[concat(parameters('dnsName'), '-nic')]",
    "availabilitySetName": "[concat(parameters('dnsName'), 'AS')]",
    "customScriptFilePath": "[concat(parameters('artifactsPath'), '/azuremysql.sh')]",
    "mysqlConfigFilePath": "[concat(parameters('artifactsPath'), '/my.cnf.template')]",
    "singleQuote": "",
    "virtualNetworkSetupURL": "[concat(parameters('artifactsPath'),'/vnet-',parameters('vnetNewOrExisting'),'.json')]",
    "sa": "[parameters('dbSubnetStartAddress')]",
    "ipOctet01": "[concat(split(variables('sa'), '.')[0], '.', split(variables('sa'), '.')[1], '.')]",
    "ipOctet2": "[int(split(variables('sa'), '.')[2])]",
    "ipOctet3": "[int(split(variables('sa'), '.')[3])]"
  },
    "resources": [
        {
            "name": "SettingUpVirtualNetwork",
            "type": "Microsoft.Resources/deployments",
            "apiVersion": "[variables('templateAPIVersion')]",
            "properties": {
                "mode": "Incremental",
                "templateLink": {
                    "uri": "[variables('virtualNetworkSetupURL')]",
                    "contentVersion": "1.0.0.0"
                },
                "parameters": {
                    "virtualNetworkName": {
                        "value": "[parameters('virtualNetworkName')]"
                    },
                    "virtualNetworkAddressPrefix": {
                        "value": "[parameters('vnetAddressPrefix')]"
                    },
                    "dbSubnetName": {
                        "value": "[parameters('dbSubnetName')]"
                    },
                    "dbSubnetAddressPrefix": {
                        "value": "[parameters('dbSubnetAddressPrefix')]"
                    },
                    "virtualNetworkExistingRGName": {
                        "value": "[parameters('virtualNetworkExistingRGName')]"
                    }
                }
            }
        },
      {
        "type": "Microsoft.Storage/storageAccounts",
        "name": "[variables('storageAccountName')]",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "properties": {
          "accountType": "[parameters('storageAccountType')]"
        }
      },
      {
        "type": "Microsoft.Compute/availabilitySets",
        "name": "[variables('availabilitySetName')]",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "properties": { }
      },
      {
        "apiVersion": "[variables('resourceAPIVersion')]",
        "type": "Microsoft.Network/networkInterfaces",
        "name": "[concat(variables('nicName'), copyIndex())]",
        "location": "[resourceGroup().location]",
        "copy": {
          "name": "nicLoop",
          "count": "[variables('nodeCount')]"
        },
        "dependsOn": [
          "[concat('Microsoft.Resources/deployments/', 'SettingUpVirtualNetwork')]",
          "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]"
        ],
        "properties": {
          "ipConfigurations": [
            {
              "name": "[concat('ipconfig', copyIndex())]",
              "properties": {
                "privateIPAllocationMethod": "Static",
                "privateIPAddress": "[concat(variables('ipOctet01'), add(variables('ipOctet2'), div(copyIndex(variables('ipOctet3')), 255)), '.', mod(copyIndex(variables('ipOctet3')), 255))]",
                "subnet": {
                  "id": "[reference('Microsoft.Resources/deployments/SettingUpVirtualNetwork', variables('templateAPIVersion')).outputs.dbSubnetRef.value]"
                },
                "loadBalancerBackendAddressPools": [
                  {
                    "id": "[variables('ilbBackendAddressPoolID')]"
                  }
                ],
                "loadBalancerInboundNatRules": [
                  {
                    "id": "[concat(variables('lbID'),'/inboundNatRules/',parameters('dnsName'), 'NatRule', copyIndex())]"
                  },
                  {
                    "id": "[concat(variables('lbID'),'/inboundNatRules/',parameters('dnsName'), 'ProbeNatRule', copyIndex())]"
                  },
                  {
                    "id": "[concat(variables('lbID'),'/inboundNatRules/',parameters('dnsName'), 'MySQLNatRule', copyIndex())]"
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "name": "[concat(parameters('dnsName'), copyIndex())]",
        "type": "Microsoft.Compute/virtualMachines",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "copy": {
          "name": "vmLoop",
          "count": "[variables('nodeCount')]"
        },
        "dependsOn": [
          "[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]",
          "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
          "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyIndex())]"
        ],
        "properties": {
          "availabilitySet": {
            "id": "[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
          },
          "hardwareProfile": {
            "vmSize": "[parameters('vmSize')]"
          },
          "osProfile": {
            "computerName": "[concat(parameters('dnsName'), copyIndex())]",
            "adminUsername": "[parameters('vmUserName')]",
            "adminPassword": "[parameters('vmPassword')]"
          },
          "storageProfile": {
            "imageReference": {
              "publisher": "[parameters('imagePublisher')]",
              "offer": "[parameters('imageOffer')]",
              "sku": "[parameters('imageSKU')]",
              "version": "latest"
            },
            "osDisk": {
              "name": "osdisk",
              "vhd": {
                "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('resourceAPIVersion')).primaryEndpoints.blob, 'vhds/', parameters('dnsName'), copyIndex(), 'osdisk.vhd')]"
              },
              "caching": "ReadWrite",
              "createOption": "FromImage"
            },
            "dataDisks": [
              {
                "name": "datadisk1",
                "diskSizeGB": "1000",
                "lun": 0,
                "vhd": {
                  "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('resourceAPIVersion')).primaryEndpoints.blob, 'vhds/', parameters('dnsName'), copyIndex(), 'dataDisk1.vhd')]"
                },
                "createOption": "Empty"
              },
              {
                "name": "datadisk2",
                "diskSizeGB": "1000",
                "lun": 1,
                "vhd": {
                  "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('resourceAPIVersion')).primaryEndpoints.blob, 'vhds/', parameters('dnsName'), copyIndex(), 'dataDisk2.vhd')]"
                },
                "createOption": "Empty"
              }
            ]
          },
          "networkProfile": {
            "networkInterfaces": [
              {
                "id": "[concat(resourceId('Microsoft.Network/networkInterfaces',variables('nicName')), copyIndex())]"
              }
            ]
          }
        }
      },
      {
        "type": "Microsoft.Compute/virtualMachines/extensions",
        "name": "[concat(parameters('dnsName'), copyIndex(), '/setupMySQL')]",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "copy": {
          "name": "extLoop",
          "count": "[variables('nodeCount')]"
        },
        "dependsOn": [
          "[concat('Microsoft.Compute/virtualMachines/', parameters('dnsName'), copyIndex())]"
        ],
        "properties": {
          "publisher": "Microsoft.OSTCExtensions",
          "type": "CustomScriptForLinux",
          "typeHandlerVersion": "1.4",
          "settings": {
            "fileUris": [
              "[variables('customScriptFilePath')]"
            ]
          },
          "protectedSettings": {
            "commandToExecute": "[concat(parameters('customScriptCommandToExecute'), ' ', copyIndex(1), ' ', variables('ipOctet01'), add(variables('ipOctet2'), div(copyIndex(variables('ipOctet3')), 255)), '.', mod(copyIndex(variables('ipOctet3')), 255), ' ', variables('mysqlConfigFilePath'), ' ', variables('singleQuote'), parameters('mysqlReplicationPassword'), variables('singleQuote'), ' ', variables('singleQuote'), parameters('mysqlRootPassword'), variables('singleQuote'), ' ', variables('singleQuote'), parameters('mysqlProbePassword'), variables('singleQuote'), ' ', parameters('dbSubnetStartAddress'))]"
          }
        }
      },
      {
        "apiVersion": "[variables('resourceAPIVersion')]",
        "type": "Microsoft.Network/loadBalancers",
        "name": "[variables('lbName')]",
        "location": "[resourceGroup().location]",
        "properties": {
          "frontendIPConfigurations": [
            {
              "name": "[variables('sshIPConfigName')]",
              "properties": {
              	"privateIPAddress": "[parameters('dblbIP')]",
                "privateIPAllocationMethod": "Static",
                "subnet": {
                	"id": "[concat(concat(resourceId(parameters('virtualNetworkExistingRGName'),'Microsoft.Network/virtualNetworks/subnets', parameters('dbSubnetName')),'/subnets/'),parameters('dbSubnetName'))]"
                }
              }
            }
          ],
          "backendAddressPools": [
            {
              "name": "[variables('ilbBackendAddressPoolName')]"
            }
          ],
          "inboundNatRules": [
            {
              "name": "[concat(parameters('dnsName'),'NatRule0')]",
              "properties": {
                "frontendIPConfiguration": {
                  "id": "[variables('sshIPConfig')]"
                },
                "protocol": "tcp",<commit_msg>going all the way back to what I think worked.<commit_after>﻿{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "dnsName": {
            "type": "string",
            "metadata": {
                "description": "Connect to your cluster using dnsName.location.cloudapp.azure.com"
            }
        },
        "vmUserName": {
            "type": "string",
            "metadata": {
                "description": "user name to ssh to the VMs"
            }
        },
        "vmPassword": {
            "type": "securestring",
            "metadata": {
                "description": "password to ssh to the VMs"
            }
        },
        "mysqlRootPassword": {
            "type": "securestring",
            "metadata": {
                "description": "mysql root user password single quote not allowed"
            }
        },
        "mysqlReplicationPassword": {
            "type": "securestring",
            "metadata": {
                "description": "mysql replication user password single quote not allowed"
            }
        },
        "mysqlProbePassword": {
            "type": "securestring",
            "metadata": {
                "description": "mysql probe password single quote not allowed"
            }
        },
        "vmSize": {
            "type": "string",
            "defaultValue": "Standard_D2",
            "metadata": {
                "description": "size for the VMs"
            }
        },
        "storageAccountType": {
            "type": "string",
            "defaultValue": "Standard_LRS",
            "metadata": {
                "description": "Storage account type for the cluster"
            }
        },
        "virtualNetworkName": {
            "type": "string",
            "defaultValue": "mysqlvnet",
            "metadata": {
                "description": "Virtual network name for the cluster"
            }
        },
        "vnetNewOrExisting": {
            "type": "string",
            "defaultValue": "new",
            "allowedValues": [
                "new",
                "existing"
            ],
            "metadata": {
                "description": "Identifies whether to use new or existing Virtual Network"
            }
        },
        "virtualNetworkExistingRGName": {
            "type": "string",
            "defaultValue": "",
            "metadata": {
                "description": "If using existing VNet, specifies the resource group for the existing VNet"
            }
        },
        "dbSubnetName": {
            "type": "string",
            "defaultValue": "dbsubnet",
            "metadata": {
                "description": "subnet name for the MySQL nodes"
            }
        },
        "vnetAddressPrefix": {
            "type": "string",
            "defaultValue": "10.0.0.0/16",
            "metadata": {
                "description": "IP address in CIDR for virtual network"
            }
        },
        "dbSubnetAddressPrefix": {
            "type": "string",
            "defaultValue": "10.0.1.0/24",
            "metadata": {
                "description": "IP address in CIDR for db subnet"
            }
        },
        "dbSubnetStartAddress": {
            "type": "string",
            "defaultValue": "10.0.1.4",
            "metadata": {
                "description": "Start IP address in the subnet for the VMs"
            }
        },
        "imagePublisher": {
            "type": "string",
            "defaultValue": "OpenLogic",
            "allowedValues": [
                "OpenLogic"
            ],
            "metadata": {
                "description": "publisher for the VM OS image"
            }
        },
        "imageOffer": {
            "type": "string",
            "defaultValue": "CentOS",
            "allowedValues": [
                "CentOS"
            ],
            "metadata": {
                "description": "VM OS name"
            }
        },
        "imageSKU": {
            "type": "string",
            "defaultValue": "6.6",
            "allowedValues": [
                "6.5",
                "6.6"
            ],
            "metadata": {
                "description": "VM OS version"
            }
        },
        "mysqlFrontEndPort0": {
            "type": "int",
            "defaultValue": 3306,
            "metadata": {
                "description": "MySQL public port master"
            }
        },
        "mysqlFrontEndPort1": {
            "type": "int",
            "defaultValue": 3307,
            "metadata": {
                "description": "MySQL public port slave"
            }
        },
        "sshNatRuleFrontEndPort0": {
            "type": "int",
            "defaultValue": 64001,
            "metadata": {
                "description": "public ssh port for VM1"
            }
        },
        "sshNatRuleFrontEndPort1": {
            "type": "int",
            "defaultValue": 64002,
            "metadata": {
                "description": "public ssh port for VM2"
            }
        },
        "mysqlProbePort0": {
            "type": "int",
            "defaultValue": 9200,
            "metadata": {
                "description": "MySQL public port master"
            }
        },
        "mysqlProbePort1": {
            "type": "int",
            "defaultValue": 9201,
            "metadata": {
                "description": "MySQL public port slave"
            }
        },
        "artifactsPath": {
            "type": "string",
            "defaultValue": "https://raw.githubusercontent.com/jarobey/azure-quickstart-templates/master/mysql-replication",
            "metadata": {
                "description": "template and script file location",
                "artifactsBaseUrl": "Base URL of the Publisher Template gallery package"
            }
        },
        "customScriptCommandToExecute": {
            "type": "string",
            "defaultValue": "bash azuremysql.sh",
            "metadata": {
                "description": "bash script command line"
            }
        },
        "dblbIP": {
            "type": "string",
            "defaultValue": "10.0.1.6",
            "metadata": {
                "description": "private IP address for MySQL loadbalancer"
            }
        }
    },
  "variables": {
    "templateAPIVersion": "2015-01-01",
    "resourceAPIVersion": "2015-06-15",
    "storageAccountName": "[concat(uniquestring(resourceGroup().id),'storage')]",
    "nodeCount": 2,
    "lbName": "[concat(parameters('dnsName'), '-lb')]",
    "lbID": "[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]",
    "ilbBackendAddressPoolName": "[concat(parameters('dnsName'), '-ilbBackendPool')]",
    "ilbBackendAddressPoolID": "[concat(variables('lbID'),'/backendAddressPools/', variables('ilbBackendAddressPoolName'))]",
    "ilbRuleName": "[concat(parameters('dnsName'), '-ilbRule')]",
    "ilbRuleID": "[concat(variables('lbID'),'/loadBalancingRules/',variables('ilbRuleName'))]",
    "sshIPConfigName": "[concat(parameters('dnsName'), '-sshIPCfg')]",
    "sshIPConfig": "[concat(variables('lbID'),'/frontendIPConfigurations/',variables('sshIPConfigName'))]",
    "nicName": "[concat(parameters('dnsName'), '-nic')]",
    "availabilitySetName": "[concat(parameters('dnsName'), 'AS')]",
    "customScriptFilePath": "[concat(parameters('artifactsPath'), '/azuremysql.sh')]",
    "mysqlConfigFilePath": "[concat(parameters('artifactsPath'), '/my.cnf.template')]",
    "singleQuote": "",
    "virtualNetworkSetupURL": "[concat(parameters('artifactsPath'),'/vnet-',parameters('vnetNewOrExisting'),'.json')]",
    "sa": "[parameters('dbSubnetStartAddress')]",
    "ipOctet01": "[concat(split(variables('sa'), '.')[0], '.', split(variables('sa'), '.')[1], '.')]",
    "ipOctet2": "[int(split(variables('sa'), '.')[2])]",
    "ipOctet3": "[int(split(variables('sa'), '.')[3])]"
  },
    "resources": [
        {
            "name": "SettingUpVirtualNetwork",
            "type": "Microsoft.Resources/deployments",
            "apiVersion": "[variables('templateAPIVersion')]",
            "properties": {
                "mode": "Incremental",
                "templateLink": {
                    "uri": "[variables('virtualNetworkSetupURL')]",
                    "contentVersion": "1.0.0.0"
                },
                "parameters": {
                    "virtualNetworkName": {
                        "value": "[parameters('virtualNetworkName')]"
                    },
                    "virtualNetworkAddressPrefix": {
                        "value": "[parameters('vnetAddressPrefix')]"
                    },
                    "dbSubnetName": {
                        "value": "[parameters('dbSubnetName')]"
                    },
                    "dbSubnetAddressPrefix": {
                        "value": "[parameters('dbSubnetAddressPrefix')]"
                    },
                    "virtualNetworkExistingRGName": {
                        "value": "[parameters('virtualNetworkExistingRGName')]"
                    }
                }
            }
        },
      {
        "type": "Microsoft.Storage/storageAccounts",
        "name": "[variables('storageAccountName')]",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "properties": {
          "accountType": "[parameters('storageAccountType')]"
        }
      },
      {
        "type": "Microsoft.Compute/availabilitySets",
        "name": "[variables('availabilitySetName')]",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "properties": { }
      },
      {
        "apiVersion": "[variables('resourceAPIVersion')]",
        "type": "Microsoft.Network/networkInterfaces",
        "name": "[concat(variables('nicName'), copyIndex())]",
        "location": "[resourceGroup().location]",
        "copy": {
          "name": "nicLoop",
          "count": "[variables('nodeCount')]"
        },
        "dependsOn": [
          "[concat('Microsoft.Resources/deployments/', 'SettingUpVirtualNetwork')]",
          "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]"
        ],
        "properties": {
          "ipConfigurations": [
            {
              "name": "[concat('ipconfig', copyIndex())]",
              "properties": {
                "privateIPAllocationMethod": "Static",
                "privateIPAddress": "[concat(variables('ipOctet01'), add(variables('ipOctet2'), div(copyIndex(variables('ipOctet3')), 255)), '.', mod(copyIndex(variables('ipOctet3')), 255))]",
                "subnet": {
                  "id": "[reference('Microsoft.Resources/deployments/SettingUpVirtualNetwork', variables('templateAPIVersion')).outputs.dbSubnetRef.value]"
                },
                "loadBalancerBackendAddressPools": [
                  {
                    "id": "[variables('ilbBackendAddressPoolID')]"
                  }
                ],
                "loadBalancerInboundNatRules": [
                  {
                    "id": "[concat(variables('lbID'),'/inboundNatRules/',parameters('dnsName'), 'NatRule', copyIndex())]"
                  },
                  {
                    "id": "[concat(variables('lbID'),'/inboundNatRules/',parameters('dnsName'), 'ProbeNatRule', copyIndex())]"
                  },
                  {
                    "id": "[concat(variables('lbID'),'/inboundNatRules/',parameters('dnsName'), 'MySQLNatRule', copyIndex())]"
                  }
                ]
              }
            }
          ]
        }
      },
      {
        "name": "[concat(parameters('dnsName'), copyIndex())]",
        "type": "Microsoft.Compute/virtualMachines",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "copy": {
          "name": "vmLoop",
          "count": "[variables('nodeCount')]"
        },
        "dependsOn": [
          "[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]",
          "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
          "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyIndex())]"
        ],
        "properties": {
          "availabilitySet": {
            "id": "[resourceId('Microsoft.Compute/availabilitySets', variables('availabilitySetName'))]"
          },
          "hardwareProfile": {
            "vmSize": "[parameters('vmSize')]"
          },
          "osProfile": {
            "computerName": "[concat(parameters('dnsName'), copyIndex())]",
            "adminUsername": "[parameters('vmUserName')]",
            "adminPassword": "[parameters('vmPassword')]"
          },
          "storageProfile": {
            "imageReference": {
              "publisher": "[parameters('imagePublisher')]",
              "offer": "[parameters('imageOffer')]",
              "sku": "[parameters('imageSKU')]",
              "version": "latest"
            },
            "osDisk": {
              "name": "osdisk",
              "vhd": {
                "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('resourceAPIVersion')).primaryEndpoints.blob, 'vhds/', parameters('dnsName'), copyIndex(), 'osdisk.vhd')]"
              },
              "caching": "ReadWrite",
              "createOption": "FromImage"
            },
            "dataDisks": [
              {
                "name": "datadisk1",
                "diskSizeGB": "1000",
                "lun": 0,
                "vhd": {
                  "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('resourceAPIVersion')).primaryEndpoints.blob, 'vhds/', parameters('dnsName'), copyIndex(), 'dataDisk1.vhd')]"
                },
                "createOption": "Empty"
              },
              {
                "name": "datadisk2",
                "diskSizeGB": "1000",
                "lun": 1,
                "vhd": {
                  "uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName')), variables('resourceAPIVersion')).primaryEndpoints.blob, 'vhds/', parameters('dnsName'), copyIndex(), 'dataDisk2.vhd')]"
                },
                "createOption": "Empty"
              }
            ]
          },
          "networkProfile": {
            "networkInterfaces": [
              {
                "id": "[concat(resourceId('Microsoft.Network/networkInterfaces',variables('nicName')), copyIndex())]"
              }
            ]
          }
        }
      },
      {
        "type": "Microsoft.Compute/virtualMachines/extensions",
        "name": "[concat(parameters('dnsName'), copyIndex(), '/setupMySQL')]",
        "apiVersion": "[variables('resourceAPIVersion')]",
        "location": "[resourceGroup().location]",
        "copy": {
          "name": "extLoop",
          "count": "[variables('nodeCount')]"
        },
        "dependsOn": [
          "[concat('Microsoft.Compute/virtualMachines/', parameters('dnsName'), copyIndex())]"
        ],
        "properties": {
          "publisher": "Microsoft.OSTCExtensions",
          "type": "CustomScriptForLinux",
          "typeHandlerVersion": "1.4",
          "settings": {
            "fileUris": [
              "[variables('customScriptFilePath')]"
            ]
          },
          "protectedSettings": {
            "commandToExecute": "[concat(parameters('customScriptCommandToExecute'), ' ', copyIndex(1), ' ', variables('ipOctet01'), add(variables('ipOctet2'), div(copyIndex(variables('ipOctet3')), 255)), '.', mod(copyIndex(variables('ipOctet3')), 255), ' ', variables('mysqlConfigFilePath'), ' ', variables('singleQuote'), parameters('mysqlReplicationPassword'), variables('singleQuote'), ' ', variables('singleQuote'), parameters('mysqlRootPassword'), variables('singleQuote'), ' ', variables('singleQuote'), parameters('mysqlProbePassword'), variables('singleQuote'), ' ', parameters('dbSubnetStartAddress'))]"
          }
        }
      },
      {
        "apiVersion": "[variables('resourceAPIVersion')]",
        "type": "Microsoft.Network/loadBalancers",
        "name": "[variables('lbName')]",
        "location": "[resourceGroup().location]",
        "properties": {
          "frontendIPConfigurations": [
            {
              "name": "[variables('sshIPConfigName')]",
              "properties": {
              	"privateIPAddress": "[parameters('dblbIP')]",
                "privateIPAllocationMethod": "Static",
                "subnet": {
                	"id": "[concat(concat(resourceId(parameters('virtualNetworkExistingRGName'),'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName')),'/subnets/'),parameters('dbSubnetName'))]"
                }
              }
            }
          ],
          "backendAddressPools": [
            {
              "name": "[variables('ilbBackendAddressPoolName')]"
            }
          ],
          "inboundNatRules": [
            {
              "name": "[concat(parameters('dnsName'),'NatRule0')]",
              "properties": {
                "frontendIPConfiguration": {
                  "id": "[variables('sshIPConfig')]"
                },
                "protocol": "tcp",
{'fraction_non_alphanumeric': 0.1646029340272813, 'fraction_numerical': 0.008350253081300581, 'mean_word_length': 1.7837923897468555, 'pattern_counts': {'":': 588, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 12, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1989472', 'n_tokens_mistral': 9395, 'n_tokens_neox': 8929, 'n_words': 1434}