{
  "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
  "handler": "Microsoft.Compute.MultiVm",
  "version": "0.1.2-preview",
  "parameters": {
    "basics": [
      {}
    ],
    "steps": [
      {
        "name": "vmCredentials",
        "label": "VM Credential",
        "bladeTitle": "VM Credential",
        "subLabel": {
          "preValidation": "Provide VM credentials",
          "postValidation": "Great - let's move on!"
        },
        "elements": [
          {
            "name": "adminUsername",
            "type": "Microsoft.Compute.UserNameTextBox",
            "label": "Admin username",
            "osPlatform": "Linux",
            "constraints": {
              "required": true,
              "regex": "^[a-z0-9A-Z]{1,30}$",
              "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
            },
            "toolTip": "Provide admin username for the virtual machine"
          },
          {
            "name": "adminPassword",
            "type": "Microsoft.Compute.CredentialsCombo",
            "label": {
              "password": "Password",
              "confirmPassword": "Confirm password"
            },
            "osPlatform": "Linux",
            "constraints": {
              "required": true,
              "customPasswordRegex": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)[A-Za-z\\d]{12,}$",
              "customValidationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
            },
            "options": {
              "hideConfirmation": false
            },
            "toolTip": {
              "password": "Provide admin password for the virtual machine"
            },
            "visible": true
          },
          {
            "name": "privateRepoUsername",
            "type": "Microsoft.Compute.UserNameTextBox",
            "label": "Private Repo username",
            "osPlatform": "Linux",
            "constraints": {
              "required": false,
              "regex": "^[a-z0-9A-Z]{1,30}$",
              "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
            },
            "toolTip": "If you were provided a repo username and apikey by JFrog, enter it here"
          },
          {
            "name": "privateRepoApiKey",
            "type": "Microsoft.Compute.UserNameTextBox",
            "label": "Private Repo api key",
            "osPlatform": "Linux",
            "constraints": {
              "required": false,
              "regex": "^[a-z0-9A-Z]{1,100}$",
              "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-100 characters long."
            },
            "toolTip": "If you were provided a repo username and apikey by JFrog, enter it here"
          }
        ]
      },
      {
        "name": "clusterConfig",
        "label": "Artifactory Cluster settings",
        "subLabel": {
          "preValidation": "Configure Artifactory Cluster settings",
          "postValidation": "Done!"
        },
        "bladeTitle": "Artifactory Cluster Settings",
        "elements": [
          {
            "name": "clusterName",
            "type": "Microsoft.Common.TextBox",
            "label": "Cluster name",
            "toolTip": "Cluster name",
            "defaultValue": "",
            "constraints": {
              "required": true,
              "regex": "^[a-z0-9A-Z]{1,30}$",
              "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
            }
          },
          {
            "name": "vmSku",
            "type": "Microsoft.Compute.SizeSelector",
            "label": "Virtual machine size",
            "toolTip": "The size of the virtual machine for Artifactory",
            "recommendedSizes": [
              "Standard_A2_v2"
            ],
            "constraints": {
              "allowedSizes": [
                "Standard_A2_v2",
                "Standard_A4_v2",
                "Standard_D2s_v3",
                "Standard_D4s_v3",
                "Standard_DS2_v2",
                "Standard_DS3_v2",
                "Standard_D2_v2",
                "Standard_D3_v2",
                "Standard_DC2s",
                "Standard_DC4s"
              ]
            },
            "osPlatform": "Linux",
            "count": 1
          },

          {
            "name": "artifactoryVersion",
            "type": "Microsoft.Common.DropDown",
            "label": "Artifactory-vm image version to deploy.",
            "defaultValue": "6.15.0",
            "toolTip": "",
            "constraints": {
              "allowedValues": [
                {
                  "label": "6.15.0",
                  "value": "6.15.0"
                }
              ],
              "required": true
            },
            "visible": true
          },
          {
            "name": "masterKey",
            "type": "Microsoft.Common.TextBox",
            "label": "Artifactory master Key",
            "defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e",
            "toolTip": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'",
            "constraints": {
              "required": true,
              "regex": "^[a-z0-9A-Z]{1,32}$",
              "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long."
            }
          },
          {
            "name": "certificate",
            "type": "Microsoft.Common.TextBox",
            "label": "Provide your SS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UPbQyQIDZyxZd3Q1lUIE38ol8P66mS2zbzf8EeOCoUCAwEAAaNQME4wHQYDVR0O BBYEFETAQM/5P7XJ8kevHFj6BPndQOFaMB8GA1UdIwQYMBaAFETAQM/5P7XJ8kev HFj6BPndQOFaMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAJ1TepKv LWYhFmVQcgZwZf/qt1a1cohzJSm6da9RCnnAWC7WC/U117bgSomtrH1v0OysHFhB zBBUeBqI7+OmzAX8dhj+roKkcnFUM/IwlK1eueIIA//CWvEf/o0XExilVS2yCc9d PTpOQBXwk9QinxK36kHdBiGxa7dW0JPnOEEmuMgGORKeLy4J6Ik8iSeFY1SZVcOI +6WWvoKciPlmIeccC+6YVmkeBwhP2o5r5w/UAaO2hSnGvmm4UIj/VJv4VQu7xTUp cIfFz5NtIr80DbqcyPiEMS2ETJ4L/kO4MS5FfeEXyQuXCzmiIDVY6tE3C7+kZmK4 JzPLuWm9ndQoyQySOGfQqvlUR1+YxUdvmu3LrOS5dOA354Q36wHa4wEGUoHU/7GV fYQmmmDSDaNSpXW5PFey6scFyDBS/yYJ0H9EjYb/11HeWYj8Yv5xTWj8nhzJONC8 D6Y5ydlU4PifM2pOf88pTYpmogNwLJWXbql5I9cvMa8APo4yLVqcISU5ynsvFke+ Non+T0mHpJai/hrA9NK+s6EGC1dAX58jy61h6FhOPI1d4s/mov/KMa2t3SfZp5SF 81aR6dHvO56teiK5M1xMkrqG75zh3TMFJJLRFe9XxeB4JeN76URB3mgADOUqkBxd ibSgVqfKwOw4IujEcqMUc5mqSnbLY1Dv+oby -----END CERTIFICATE-----",
            "toolTip": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate.",
            "constraints": {
              "required": true,
              "regex": "^(-----BEGIN CERTIFICATE-----)(.+)(-----END CERTIFICATE-----)$",
              "validationMessage": "Provide SSL Certificate."
            }
          },
          {
            "name": "certificateKey",
            "type": "Microsoft.Common.TextBox",
            "label": "Provide your SSL Certificate key.",
            "defaultValue": "-----BEGIN PRIVATE KEY----- MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDsp85YNCWi/xwx ryv+VwmqJZlof2bJALvhVt7Qdeye1Bty+WOSMbY/t5ubl130HNyxq404mlsp/kCE UrWLAlQCRyIZzUtHiTzB9aZAzc09LyGuqu0fbTOo2l0VGk1iONomh/Bxw82bTfQa GFmRn3lOmu6+azAwPCymXeN+p1xz96JCwdwrIadXZr5QB6ip7smYeGaFHLUwuoCM XlTUatRhQ40D7baJEMlvhz0H3VCha+ydel0D00pX+aYDf+sh3Hot3Yg9F2sjDYrm wCdeyHdvHagJK9J+6yx/TH7hcOuexodV+PC980vwQI65pzY6L8RY6n3nbyA6iGkU C7AS3rdWXmnz8IL2bQckNNkEqbaXl4PWR08iPg+8/1Kf0LEZcpATVvFagXEZfwTJ FbRvQ0rfU3tvwk9nVKgU2IHlqY4w0u9HbprtxCsq6ZO4l5gr0lolrGExcztHQMDQ S/xkbbGbILKCjH7Uo9KYk4gSlPvQEVuPesos2o/bYRP7O8+6H7YN2DKukcV5iQZa MxtY+MrvAmwPbMzxxyglB96k/PwjitPQl+soBCAIa4Y6CCd5o0kpNUY04VuPkBd1 n9D4a82iabJF2rgnsSepjov4/bl+jmpnpRn+JLS09y/GCfQV2GylQ9tDJAgNnLFl 3dDWVQgTfyiXw/rqZLbNvN/wR44KhQIDAQABAoICAQDm1pAp7UPBCELCG/I3t0KQ GvjWu17RNcwN86SHhl92VcMolSaQ1bjF0h0Q2ccldHm5PHMWAUpnXcAk0mCO5Yh4 aFZVALEraCxBrZGrqJNH2Q9rxwJhIy2+yLD/Apb09iukZfkdnzaRBKrUQWgs6Xd0 OyAh0YBBrJCI/xAG3M0LuUMnBt3xnHQUhv2gJrhYeble5iJqOSRsEZ+OS/1G7aWX 8kI80MS6UguKpEndv/0EV7eHrHHKZ3Ee+z76Lu52Kw9qaaqYnJ0+pdkVV92PUM9f LXhY6cv7TP4sdb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CAQEA94yShDr0UC+au/R7hCXpVnB6r5YAN+KDj/sAsNwE0hDx LIoE31gU5ZbRbylQhne/QNU1NK93C8gAYEAzyYiC4mPLWYUZNAAhbjdW47iirfUH PhChX6vGOOeTU7wPZD2J7ZdczjUelLcqYar/Zc/Fl1wgOfK86bRBO733+fgbLhZm PlnCcKx5fqVDuybu/0qaqeUn1sVgs59nezURCA5gL8YxKO973GjhOU2KDmNXqfnD 49wWPk7YXzldEpW3SACdNW8futnqJFwHaKAUvLBwh/BHYmV9atScq8AnRZxERoD6 govcyg3aDvJomC/OlvvSY+BGszHl5KzTDBg3NGlH4QKCAQA/71lU5xQfqVg3K0MF ZhYHPUP/iYFw/6FSFarsUp0Higa+lzPOQHI+WHjl5a8zgDO1OQwAq6wnGnq1w0A3 2hYcClOI0O2e5KaCLuJj4fSJxRKdqGR6okosG05uLqs63+3mCPVfOc3CEyaI+Wzf SArYeT2LzvP7JSbNXq+3GpEdjcpZYpWJ7uimCmBKGz7B9runykUMBme0tbRx1X72 J6YHxaWYa2XI2IGi8O7UyTyaMzR2XOeLCPMC+yYQlNIhijkwVCyE974dhhCwOvJA nB9Oeh5Rf+a6zw2BjyKYKBCQY1yPbrutDvpYBfhQoot9Wyph3NLScj5yjri8VvAI eSO9AoIBAQDyUx5YUgHgpoJtRZ+8PGQBZHm5L5HJhvfUs96I9Z4lZSXnCmEJyOWn LIob8c0n4hU1EXdbbl+7eRQgG3oGKyF0XXhuaP3vHprIBW6tm9kCGORTliZOaZdW 0Mj9GUv2de1r8anwJMFvIMXsuO08rsGzsIt7DrNYa0YSMkeDwPenRfDHXOYH2fjf RKjlP3fQr/iLL/YuMGaNxzIeyWPZ2WTUUC0bllNxMTZmztuMkPNb7fhhs0hLecXM fE2nbwUaGwMZaails1+5G3HvEAlChJ1GN9XnYxrtfqq93tYELWBiNcv1LaMAFvj8 S+j1+iUKGGhwVmhqh75q5do3+VF3XlAh -----END PRIVATE KEY-----",
            "toolTip": "Provide your SSL Certificate key",
            "constraints": {
              "required": true,
              "regex": "^(-----BEGIN PRIVATE KEY-----)(.+)(-----END PRIVATE KEY-----)$",
              "validationMessage": "Provide SSL Certificate Key."
            }
          },
          {
            "name": "certificateDomain",
            "type": "Microsoft.Common.TextBox",
            "label": "Provide your Certificate Domain Name.",
            "defaultValue": "artifactory",
            "toolTip": "Provide your Certificate Domain Name. For e.g jfrog.team for certificate with *.jfrog.team",
            "constraints": {
              "required": true,
              "regex": "^(\\*)*([\\w-\\.])+$",
              "validationMessage": "Must be a valid fully-qualified domain name."
            }
          },
          {
            "name": "artifactoryServerName",
            "type": "Microsoft.Common.TextBox",
            "label": "Provide artifactory server name to be used in Nginx.",
            "defaultValue": "artifactory",
            "toolTip": "Provide artifactory server name to be used in Nginx. e.g artifactory for artifactory.jfrog.team",
            "constraints": {
              "required": true,
              "regex": "^[a-z0-9A-Z]{1,20}$",
              "validationMessage": "Only letters and numbers are allowed, and the value must be 1-20 characters long."
            }
          },
          {
            "name": "extraJavaOptions",
            "type": "Microsoft.Common.TextBox",
            "label": "Setting Java Memory Parameters for Artifactory",
            "defaultValue": "-server -Xms512m -Xmx2g -Xss256k -XX:+UseG1GC -XX:OnOutOfMemoryError=\\\"kill -9 %p\\\"",
            "toolTip": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware.",
            "constraints": {
              "required": true,
              "regex": "^.{1,10000}",
              "validationMessage": "Provide SSL Certificate Key."
            }
          }
        ]
      },
      {
        "name": "databaseConfig",
        "label": "Database Configuration",
        "subLabel": {
          "preValidation": "Configure the Database",
          "postValidation": "Done"
        },
        "bladeTitle": "Database Credential",
        "elements": [
          {
            "name": "dbAdminUsername",
            "type": "Microsoft.Compute.UserNameTextBox",
            "label": "User name",
            "toolTip": "Admin username for the database",
            "osPlatform": "Linux",
            "constraints": {
              "required": true,
              "regex": "^[a-z0-9A-Z]{1,30}$",
              "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long."
            }
          },
          {
            "name": "dbAdminPassword",
            "type": "Microsoft.Common.PasswordBox",
            "label": {
              "password": "Password",
              "confirmPassword": "Confirm password"
            },
            "toolTip": "Admin password for the database",
            "constraints": {
              "required": true,
              "regex": "^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)[A-Za-z\\d]{12,}$",
              "validationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number."
            },
            "options": {
              "hideConfirmation": false
            },
            "visible": true
          },
          {
            "name": "dbName",
            "type": "Microsoft.Common.TextBox",
            "label": "Database name",
            "toolTip": "Database name",
            "constraints": {
              "required": true,
              "regex": "^[a-z0-9A-Z]{1,15}$",
              "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long."
            }
          },
          {
            "name": "dbEdition",
            "type": "Microsoft.Common.DropDown",
            "label": "Database Edition",
            "defaultValue": "Basic",
            "toolTip": "",
            "constraints": {
              "allowedValues": [
                {
                  "label": "Basic",
                  "value": "Basic"
                },
                {
                  "label": "Standard",
                  "value": "Standard"
                },
                {
                  "label": "Premium",
                  "value": "Premium"
                }
              ],
              "required": true
            },
            "visible": true
          }
        ]
      },
      {
        "name": "storageConfig",
        "label": "Storage settings",
        "subLabel": {
          "preValidation": "Configure the infrastructure settings",
          "postValidation": "Done"
        },
        "bladeTitle": "Storage settings",
        "elements": [
          {
            "name": "storageAccountsType",
            "type": "Microsoft.Common.DropDown",
            "label": "Storage account type",
            "defaultValue": "Standard_LRS",
            "toolTip": "Storage account type",
            "constraints": {
              "allowedValues": [
                {
                  "label": "Premium_LRS",
                  "value": "Premium_LRS"
                },
                {
                  "label": "Standard_LRS",
                  "value": "Standard_LRS"
                },
                {
                  "label": "Standard_GRS",
                  "value": "Standard_GRS"
                }
              ],
              "required": true
            },
            "visible": true
          }
        ]
      }
    ],
    "outputs": {
      "clusterName": "[steps('clusterConfig').clusterName]",
      "vmSku": "[steps('clusterConfig').vmSku]",
      "location": "[location()]",
      "artifactoryVersion": "[steps('clusterConfig').artifactoryVersion]",
      "masterKey": "[steps('clusterConfig').masterKey]",
      "certificate": "[steps('clusterConfig').certificate]",
      "certificateKey": "[steps('clusterConfig').certificateKey]",
      "certificateDomain": "[steps('clusterConfig').certificateDomain]",
      "artifactoryServerName": "[steps('clusterConfig').artifactoryServerName]",
      "extraJavaOptions": "[steps('clusterConfig').extraJavaOptions]",
      "adminUsername": "[steps('vmCredentials').adminUsername]",
      "adminPassword": "[steps('vmCredentials').adminPassword.password]",
      "privateRepoUsername": "[steps('vmCredentials').privateRepoUsername]",
      "privateRepoApiKey": "[steps('vmCredentials').privateRepoApiKey]",
      "DB_Admin_User": "[steps('databaseConfig').dbAdminUsername]",
      "DB_Admin_Password": "[steps('databaseConfig').dbAdminPassword]",
      "DB_Name": "[steps('databaseConfig').dbName]",
      "DB_Edition": "[steps('databaseConfig').dbEdition]",
      "storageAccountType": "[steps('storageConfig').storageAccountsType]"
    }
  }
}