Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleazuredeploy.json
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "NamingPrefix": {
      "type": "string",
      "minLength": 3,
      "maxLength": 16,
      "defaultValue": "DEVWINFSS",
      "metadata": {
        "description": "VM Naming Prefix"
      }
    },
    "NamingPostfix": {
      "type": "string",
      "defaultValue": "01",
      "maxLength": 2,
      "metadata": {
        "description": "VM Naming Postfix"
      }
    },
    "LocalAdminUser": {
      "type": "string",
      "defaultValue": "XXX",
      "metadata": {
        "description": "Username for the local admin user"
      }
    },
    "LocalAdminPassword": {
      "type": "securestring",
      "defaultValue": "XXXdummy_password",
      "metadata": {
        "description": "Password for the local admin user"
      }
    },
    "VMSize": {
      "type": "string",
      "allowedValues": [
        "Standard_D4s_v5",
        "Standard_B2s",
        "Standard_B2ms",
        "Standard_B4ms",
        "Standard_B8ms",
        "Standard_D2s_v3",
        "Standard_D4s_v3",
        "Standard_D8s_v3"
      ],
      "defaultValue": "Standard_B2s",
      "metadata": {
        "description": "VM Size SKU."
      }
    },
    "VnetResourceID": {
      "type": "string",
      "defaultValue": "fewsmc00-vnet",
      "metadata": {
        "description": "Resource ID of the Vnet that you would like the VM's NIC to be placed in"
      }
    },
    "SubNetName": {
      "type": "string",
      "defaultValue": "PrivateSubnet",
      "metadata": {
        "description": "the name of the subnet that this VM will placed in"
      }
    },
    "OSVersion": {
      "type": "string",
      "defaultValue": "2019-Datacenter-smalldisk",
      "allowedValues": [
        "2019-Datacenter",
        "2019-Datacenter-smalldisk"
      ],
      "metadata": {
        "description": "The Windows version for the VM. This will pick a fully patched image of this given Windows version. Using the small disk allow creating a c: drive from 32GBytes and up."
      }
    },
    "DiskSizeGB": {
      "type": "string",
      "defaultValue": "32",
      "metadata": {
        "description": "The size of the OS Disk."
      }
    },
    "FewsBaseBuildUrl": {
      "type": "string",
      "defaultValue": "https://myblobstorage.blob.core.windows.net/delft-fews-base-builds/fews-development-202302-121196-bin.zip",
      "metadata": {
        "description": "Basbuild distribution URL"
      }
    },
    "DatabaseUrl": {
      "type": "string",
      "defaultValue": "XXX",
      "metadata": {
        "description": "Database URL. Use a database URL with credentials encoded. The URL can be stored in Azure Keyvault."
      }
    },
    "FssClientConfig": {
      "type": "string",
      "defaultValue": "fss_clientConfig.xml",
      "metadata": {
        "description": "client config to use on this Forecasting Shell Server"
      }
    },
    "ResourceTags": {
      "type": "object",
      "defaultValue": {
        "fssgroup": "windows_scalable"
      }
    },
    "FssGroup": {
      "type": "string",
      "defaultValue": "windows_scalable",
      "metadata": {
        "description": "Group this FSS is part of."
      }
    }
  },
  "variables": {
    "Location": "[resourceGroup().location]",
    "SubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('VnetResourceID'), parameters('SubNetName'))]",
    "VMName": "[concat(parameters('NamingPrefix'),parameters('NamingPostfix'))]",
    "NicNamePrivate": "[concat(variables('VMName'), '-nic')]",
    "NicPrivateResource": "[resourceId('Microsoft.Network/networkInterfaces', variables('NicNamePrivate'))]",
    "OSDiskName": "[concat(variables('VMName'), '-osdisk')]",
    "env": {
           "FEWS_FSS_HOME_DIR": "c:/fews/fss",
           "FEWS_FSS_INDEX_1_DATABASE_URL": "[parameters('DatabaseUrl')]",
           "FEWS_FSS_INDEX_1_CLIENT_CONFIG_FILE_NAME": "[parameters('FssClientConfig')]",
           "FEWS_FSS_INDEX_1_GROUP": "[parameters('FssGroup')]"
           },
    "installScript": "Start-BitsTransfer -Source \"__BASEBUILD_DISTRIBUTION_URL__\" -Destination \"c:\\bin.zip\"\nExpand-Archive \"c:\\bin.zip\" -DestinationPath \"c:\\fews\\bin\";\nRemove-Item -Path \"c:\\bin.zip\";\nc:\\fews\\bin\\windows\\setEnvFromJsonBase64.ps1 \"__BASE64_ENV_VARIABLES__\";\nc:\\fews\\bin\\windows\\fssLauncherRegisterService.bat\nc:\\fews\\bin\\windows\\fssLauncherStartService.bat\n$driveLetter = \"C\"\n$size = (Get-PartitionSupportedSize -DriveLetter $driveLetter)\nResize-Partition -DriveLetter $driveLetter -Size $size.SizeMax\n",
    "installData": "[replace(replace(variables('installScript'),'__BASE64_ENV_VARIABLES__',base64(string(variables('env')))),'__BASEBUILD_DISTRIBUTION_URL__',parameters('FewsBaseBuildUrl'))]"
  },
  "resources": [
    {
      "name": "[variables('NicNamePrivate')]",
      "apiVersion": "2018-08-01",
      "type": "Microsoft.Network/networkInterfaces",
      "location": "[variables('Location')]",
      "dependsOn": [],
      "properties": {
          "ipConfigurations": [
              {
                  "name": "ipconfig1",
                  "properties": {
                      "privateIPAllocationMethod": "Dynamic",
                      "subnet": {
                          "id": "[variables('SubnetRef')]"
                      }
                  }
              }
          ]
      }
    },
    {
      "name": "[variables('VMName')]",
      "type": "Microsoft.Compute/virtualMachines",
      "apiVersion": "2019-03-01",
      "location": "[variables('Location')]",
      "tags": "[parameters('ResourceTags')]",
      "dependsOn": [
        "[variables('NicPrivateResource')]"
      ],
      "properties": {
        "hardwareProfile": {
          "vmSize": "[parameters('VMSize')]"
        },
        "osProfile": {
          "computerName": "[variables('VMName')]",
          "adminUsername": "[parameters('LocalAdminUser')]",
          "adminPassword": "[parameters('LocalAdminPassword')]",
          "customData": "[base64(variables('installData'))]"
        },
        "storageProfile": {
          "imageReference": {
            "publisher": "MicrosoftWindowsServer",
            "offer": "WindowsServer",
            "sku": "[parameters('OSVersion')]",
            "version": "latest"
          },
          "osDisk": {
            "name": "[variables('OSDiskName')]",
            "caching": "ReadWrite",
            "createOption": "FromImage",
            "diskSizeGB": "[parameters('DiskSizeGB')]",
            "managedDisk": {
              "storageAccountType": "Premium_LRS"
            }
          },
          "dataDisks": [
          ]
        },
         "networkProfile": {
          "networkInterfaces": [
            {
              "properties": {
                "primary": true
              },
              "id": "[variables('NicPrivateResource')]"
            }
          ]
        },
        "licenseType": "Windows_Server"
      }
    },
    {
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "apiVersion": "2020-06-01",
      "name": "[concat(variables('VMName'), '/', 'DelftFewsForecastingShellServerInstaller')]",
      "location": "[resourceGroup().location]",
      "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/', variables('VMName'))]"
      ],
      "properties": {
        "publisher": "Microsoft.Compute",
        "type": "CustomScriptExtension",
        "typeHandlerVersion": "1.9",
        "autoUpgradeMinorVersion": true,
        "protectedSettings": {
          "commandToExecute": "powershell -ExecutionPolicy Unrestricted < %SYSTEMDRIVE%\\AzureData\\CustomData.bin"
        }
      }
    }
  ]
}